home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / renderGlobalsWindow.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  134.4 KB  |  4,222 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  6 November 1998
  22. //
  23. //  Description:
  24. //      This file contains all of the methods needed to run
  25. //        the Render Globals window.  Render Globals change 
  26. //        the information that is system-wide (as opposed to
  27. //        object-specific) and affects the renderer.
  28. //
  29.  
  30. //   We ignore 
  31. //            defaultRenderGlobals.useMayaFileName
  32. //            defaultRenderGlobals.animationRange
  33.  
  34.  
  35. global proc updateFileOutputFeedback ()
  36. //
  37. //  Procedure Name:
  38. //      updateFileOutputFeedback
  39. //
  40. //  Description:
  41. //      Updates lines of text that allow the user to see
  42. //        what files are going to be created when they render.
  43. //
  44. {
  45.     string $title1 = "  File Name:  ";
  46.     string $title2 = "  To:             ";
  47.  
  48.     string $prefix = `textFieldGrp -query -text fileName`;
  49.     if ($prefix == "(not set; using filename)") {
  50.         string $sceneName = `file -q -sn`;
  51.         if (size($sceneName) == 0) {
  52.             $prefix = "untitled";
  53.         } else {
  54.             string $buffer[];
  55.             tokenize $sceneName "/\\:" $buffer;
  56.             string $tail = $buffer[size($buffer) - 1];
  57.             tokenize $tail "." $buffer;
  58.             $tail = $buffer[0];
  59.             $prefix = $tail;
  60.         }
  61.     }
  62.  
  63.     // Image extension
  64.     string $imageType;
  65.     int $imageUse = `getAttr "defaultRenderGlobals.outFormatControl"`;
  66.     if ($imageUse == 1) {
  67.         // Don't use extension
  68.         $imageType = "";
  69.     } else if ($imageUse == 0) {
  70.         // Show the extension
  71.         global string $imgExt[];  // This is the actual file extension
  72.         global int $imgExtNum[];  // This is the corresponding internal value
  73.  
  74.         int $imageNum = `getAttr "defaultRenderGlobals.imageFormat"`;
  75.         for ($i=0; $i < size($imgExtNum); ++$i) {
  76.             if ($imageNum == $imgExtNum[$i]) {
  77.                 $imageType = "."+$imgExt[$i];
  78.                 break;
  79.             }
  80.         }
  81.     } else if ($imageUse == 2) {
  82.         // User specified
  83.         $imageType = "."+`getAttr "defaultRenderGlobals.outFormatExt"` ;
  84.     }
  85.     
  86.     // Frames number extension
  87.     string $frame1 = "";
  88.     string $frame2 = "";
  89.     int $useAnim = `getAttr "defaultRenderGlobals.animation"`;
  90.     if ($useAnim) {
  91.         // if useAnim, make sure it's not a movie format, or else
  92.         // bad extension names will be printed out to the window.
  93.         int $imgFormat = `getAttr "defaultRenderGlobals.imageFormat"`;
  94.         if ($imgFormat == 21 || $imgFormat == 22 || $imgFormat == 23)
  95.             $useAnim = 0;
  96.     }
  97.     if ($useAnim) {
  98.         float $byf = `getAttr defaultRenderGlobals.byFrameStep`;
  99.         if ($byf == 0.0) $byf = 0.00001;
  100.  
  101.         int $pad = `getAttr "defaultRenderGlobals.extensionPadding"`;
  102.         int $f1 = `getAttr "defaultRenderGlobals.startFrame"`;
  103.         int $f2 = `getAttr "defaultRenderGlobals.endFrame"`;
  104.         int $numFrames = ($f2 - $f1) / $byf;
  105.  
  106.         // Check to see if the numbers are being modified
  107.         if (`getAttr "defaultRenderGlobals.modifyExtension"`) {
  108.             $f1 = `getAttr defaultRenderGlobals.startExtension`;
  109.             $f2 = $f1 + ($numFrames * `getAttr defaultRenderGlobals.byExtension`);
  110.         }
  111.             
  112.         // Convert to strings
  113.         $frame1 = $f1;
  114.         $frame2 = $f2;
  115.  
  116.         // Pad the numbers
  117.         for ($i=size($frame1); $i<$pad; $i++) {
  118.             $frame1 = "0"+$frame1;
  119.         }
  120.         if (`getAttr "defaultRenderGlobals.periodInExt"`)
  121.             $frame1 = "."+$frame1;
  122.  
  123.         for ($i=size($frame2); $i<$pad; $i++) {
  124.             $frame2 = "0"+$frame2;
  125.         }
  126.         if (`getAttr "defaultRenderGlobals.periodInExt"`)
  127.             $frame2 = "."+$frame2;
  128.     }
  129.     
  130.     // Check for fields
  131.  
  132.     string $fieldExt = "";
  133.     int $whichFields = `getAttr defaultResolution.fields`;
  134.     int $useFields = ($whichFields != 0);
  135.     int $useFieldExt = (`getAttr "defaultRenderGlobals.fieldExtControl"` != 1);
  136.     int $defFieldExt = (`getAttr "defaultRenderGlobals.fieldExtControl"` == 0);
  137.     int $useCustom = (`getAttr "defaultRenderGlobals.fieldExtControl"` == 2);
  138.     
  139.     // Note that I am not using a "." in front of these.
  140.     // That's the way the code works now.  
  141.     // I think that there should be a "."
  142.     //
  143.     if ($useFields && $useFieldExt) {
  144.         // Add fields to the file name
  145.         if ($defFieldExt) {
  146.             if ($whichFields == 1) $fieldExt = "o";
  147.             if ($whichFields == 2) $fieldExt = "e";
  148.             if ($whichFields == 3 || $whichFields == 4) $fieldExt = "e (o)";
  149.         } else if ($useCustom) {
  150.             if ($whichFields == 1) $fieldExt = `getAttr "defaultRenderGlobals.oddFieldExt"`;
  151.             if ($whichFields == 2) $fieldExt = `getAttr "defaultRenderGlobals.evenFieldExt"`;
  152.             if ($whichFields == 3 || $whichFields == 4) $fieldExt = `getAttr "defaultRenderGlobals.oddFieldExt"`
  153.                 + " (" + `getAttr "defaultRenderGlobals.evenFieldExt"` + ")";
  154.         }
  155.     }
  156.  
  157.     // Now put them all together to show what is going to happen
  158.     int $frameBeforeExt = `getAttr "defaultRenderGlobals.putFrameBeforeExt"`;  // 0=ext.frame, 1=frame.ext
  159.     if ($frameBeforeExt == 0) {
  160.         text -edit -label ($title1+$prefix+$imageType+$frame1+$fieldExt) exampleText1;
  161.         if ($useAnim) {
  162.             text -edit -label ($title2+$prefix+$imageType+$frame2+$fieldExt) exampleText2;
  163.         } else {
  164.             text -edit -label "" exampleText2;
  165.         }
  166.     } else {
  167.         text -edit -label ($title1+$prefix+$frame1+$fieldExt+$imageType) exampleText1;
  168.         if ($useAnim) {
  169.             text -edit -label ($title2+$prefix+$frame2+$fieldExt+$imageType) exampleText2;
  170.         } else {
  171.             text -edit -label "" exampleText2;
  172.         }
  173.     }
  174. }
  175.  
  176. global proc int validFileNamePrefix(string $prefix)
  177. {
  178.     int $isValid = 1;
  179.  
  180.     if (match("[\\/:*?\"<>| !$]", $prefix) != "") {
  181.         // Most of these characters may not occur in NT filenames
  182.         // The ' ', '!' and '$' are troublesome on Unix.
  183.         catch (error ("File name prefix contains invalid character(s)."));
  184.         $isValid = 0;
  185.     }
  186.     return $isValid;
  187. }
  188.  
  189. global proc int multiframeFormat(string $format)
  190. {
  191.     int $isMultiframe = 0;
  192.  
  193.     $isMultiframe = $format == "qt" || $format == "avi" || $format == "mv";
  194.  
  195.     return $isMultiframe;
  196. }
  197.  
  198. //==================================================================
  199. //
  200. // Starting the UI updating section
  201. //
  202. //==================================================================
  203.  
  204. global proc updateImageDirectory ()
  205. //
  206. //  Procedure Name:
  207. //      updateImageDirectory
  208. //
  209. //  Description:
  210. //      Shows the Project image directory that the rendered
  211. //        images will be written to.
  212. //
  213. {
  214.     setParent renderGlobalsWindow;
  215.  
  216.     // relative path, get the project's image directory
  217.     //
  218.     string $fileRules[] = `workspace -q -rt`;
  219.     int $i;
  220.     string $imageDir = ""; // default
  221.     for ( $i = 0; $i < size($fileRules); $i += 2 ) {
  222.         if ( $fileRules[$i] == "images" ) {
  223.             $imageDir = "/" + $fileRules[$i+1];
  224.             break;
  225.         }
  226.     }
  227.  
  228.     $path = "  Path: "+(`workspace -q -fn` + $imageDir + "/");
  229.  
  230.     text -edit -label $path exampleText0;
  231. }
  232.  
  233. global proc updateImageFile ()
  234. //
  235. //  Procedure Name:
  236. //      updateImageFile
  237. //
  238. //  Description:
  239. //      Gets the real values from the nodes and sets the UI based
  240. //        on these values.  This procedure updates all of the values 
  241. //        that make up the image file name.
  242. //
  243. {
  244.     setParent renderGlobalsWindow;
  245.     string $globalsAttr = "defaultRenderGlobals.imageFilePrefix";
  246.     string $prefix = `getAttr $globalsAttr`;
  247.  
  248.     if (size($prefix) > 0) {
  249.         textFieldGrp -edit -text $prefix fileName;
  250.     } else {
  251.         textFieldGrp -edit -text "(not set; using filename)" fileName;
  252.     }
  253.  
  254.     // Extension ------------------------------------------------
  255.  
  256.     global string $imgExt[];  // This is the actual file extension
  257.     int $frameBeforeExt = `getAttr "defaultRenderGlobals.putFrameBeforeExt"`;  // 0=ext.frame, 1=frame.ext
  258.     int $activeMenuItem = 0;
  259.     int $useAnim = `getAttr "defaultRenderGlobals.animation"`;
  260.     int $imageUse = `getAttr "defaultRenderGlobals.outFormatControl"`;
  261.     int $period = `getAttr "defaultRenderGlobals.periodInExt"`;
  262.     int $ext = `optionMenuGrp -q -sl imageMenu` - 1; 
  263.     int $multiframe = multiframeFormat($imgExt[$ext]);
  264.     if ($useAnim) {
  265.         if ( $multiframe != 0 )
  266.         {
  267.             $activeMenuItem = 2;
  268.         }
  269.         else if ($imageUse == 1)
  270.         {
  271.             $activeMenuItem = 5;
  272.         }
  273.         else
  274.         {
  275.             if ($frameBeforeExt == 0) {
  276.                 $activeMenuItem = 4;
  277.             } else {
  278.                 if ($period == 0)
  279.                     $activeMenuItem = 6;
  280.                 else
  281.                     $activeMenuItem = 3;
  282.             }
  283.         }
  284.     } else {
  285.         if ($imageUse == 1) {
  286.             $activeMenuItem = 1;
  287.         } else {
  288.             $activeMenuItem = 2;
  289.         }
  290.     }
  291.     
  292.     optionMenuGrp -edit -sl $activeMenuItem extMenu;
  293.  
  294.     // Image Format ------------------------------------------------
  295.  
  296.     global string $imgExt[];  // This is the actual file extension
  297.     global int $imgExtNum[];  // This is the corresponding internal value
  298.  
  299.     int $imageNum = `getAttr "defaultRenderGlobals.imageFormat"`;
  300.     for ($i=0; $i < size($imgExtNum); ++$i) {
  301.         if ($imageNum == $imgExtNum[$i]) {
  302.             optionMenuGrp -edit -sl ($i+1) imageMenu;
  303.             break;
  304.         }
  305.     }
  306.  
  307.     // Renderable Objects ------------------------------------------------
  308.  
  309.     if (`getAttr "defaultRenderGlobals.renderAll"` == 1) {
  310.         optionMenuGrp -edit -select 1 renderObjMenu;
  311.     } else {
  312.         optionMenuGrp -edit -select 2 renderObjMenu;
  313.     }
  314. }
  315.  
  316.  
  317. global proc updateRenderableCamera ()
  318. //
  319. //  Procedure Name:
  320. //      updateRenderableCamera
  321. //
  322. //  Description:
  323. //      Gets the real values from the nodes and sets the UI based
  324. //      on these values.  This procedure updates all of the values
  325. //      that make up the renderable camera.
  326. //
  327. {
  328.     // This is a fix to get around the optionMenuGrp bug (#81337)
  329.     string $fullName = `setParent "cameraMenu"`;
  330.     string $menuName = ($fullName+"|OptionMenu");
  331.     setParent -m $menuName;
  332.  
  333.     string $allCameras[] = `ls -ca`;
  334.     string $parents[];
  335.     int    $i;
  336.     int       $numRenderable = 0;
  337.     string $cmd;
  338.  
  339.     //
  340.     // First remove any existing menuItems; we're gonna rebuild the menu
  341.     // from scratch each time.
  342.  
  343.     int $numOldMenuItems = `optionMenuGrp -q -ni cameraMenu`;
  344.     string    $oldMenuItems[] = `optionMenuGrp -q -ill cameraMenu`;
  345.  
  346.     for ($i = 0; $i < $numOldMenuItems; $i++) {
  347.         deleteUI $oldMenuItems[$i];
  348.     }
  349.  
  350.     // Run through the list of all of the cameras and build a
  351.     // optionMenu of them that the user uses to select the
  352.     // renderable camera.
  353.     //
  354.     // First count how many renderable cameras exist
  355.     //
  356.     for ($i = 0; $i < size($allCameras); $i++) {
  357.         if (`getAttr ($allCameras[$i] + ".renderable")`) {
  358.             $numRenderable++;
  359.         }
  360.     }
  361.  
  362.     int $firstRenderable = 0;
  363.     for ($i = 0; $i < size($allCameras); $i++) {
  364.         $parents = `listRelatives -p $allCameras[$i]`;
  365.         string $thisLabel = `menuItem -label $parents[0]`;
  366.         // Use the first renderable camera
  367.         if (`getAttr ($allCameras[$i] + ".renderable")`) {
  368.             $firstRenderable++;
  369.             if ($firstRenderable == 1) {
  370.  
  371.                 // Selected Camera -----------------------------------------
  372.                 optionMenuGrp -edit -sl ($i+1) cameraMenu;
  373.  
  374.                 // Channels ------------------------------------------------
  375.                 checkBoxGrp -edit -v1
  376.                     `getAttr ($allCameras[$i] + ".image")` rgbChannel;
  377.                 checkBoxGrp -edit -v1
  378.                     `getAttr ($allCameras[$i] + ".mask")` alphaChannel;
  379.                 checkBoxGrp -edit -v1
  380.                     `getAttr ($allCameras[$i] + ".depth")` depthChannel;
  381.             }
  382.             if ($numRenderable > 1) {
  383.                 string $camLabel = $parents[0] + " (Renderable)";
  384.                 menuItem -edit -label $camLabel $thisLabel;
  385.             }
  386.         }
  387.     }
  388. }
  389.  
  390. global proc updateFrames ()
  391. //
  392. //  Procedure Name:
  393. //      updateFrames
  394. //
  395. //  Description:
  396. //      Gets the real values from the nodes and sets the UI based
  397. //        on these values.  This procedure updates all of the values 
  398. //        that make up the animation frame numbers.
  399. //
  400. {
  401.     int $useAnim = `getAttr "defaultRenderGlobals.animation"`;
  402.  
  403.     // print( "updateFrames: animation " + $useAnim + "\n" );
  404.  
  405.     // Frames numbers ------------------------------------------------
  406.  
  407.     floatFieldGrp -edit
  408.         -v1 `getAttr "defaultRenderGlobals.startFrame"`
  409.         -enable $useAnim
  410.         startFrame;
  411.  
  412.     floatFieldGrp -edit
  413.         -v1 `getAttr "defaultRenderGlobals.endFrame"`
  414.         -enable $useAnim
  415.         endFrame;
  416.  
  417.     floatFieldGrp -edit
  418.         -v1 `getAttr "defaultRenderGlobals.byFrameStep"`
  419.         -enable $useAnim
  420.         frameStep;
  421.  
  422.     intFieldGrp -edit
  423.         -v1 `getAttr "defaultRenderGlobals.extensionPadding"`
  424.         -enable $useAnim
  425.         extPad;
  426.         
  427.     // Frames Options ------------------------------------------------
  428.  
  429.     // Only Update these if they exist.
  430.     // The frame may not have been created yet.
  431.     //
  432.     if (`checkBoxGrp -exists frameCheckBox`) {
  433.     
  434.         int $modExt = `getAttr "defaultRenderGlobals.modifyExtension"`;
  435.         checkBoxGrp -edit
  436.             -v1 $modExt
  437.             -enable $useAnim
  438.             frameCheckBox;
  439.         
  440.         intFieldGrp -edit 
  441.             -v1 `getAttr "defaultRenderGlobals.startExtension"`
  442.             -enable ($useAnim && $modExt)
  443.             frameStartOverride;
  444.         
  445.         intFieldGrp -edit
  446.             -v1 `getAttr "defaultRenderGlobals.byExtension"`
  447.             -enable ($useAnim && $modExt)
  448.             frameByOverride;
  449.     }
  450. }
  451.  
  452. global proc updateExtOptions ()
  453. //
  454. //  Procedure Name:
  455. //      updateExtOptions
  456. //
  457. //  Description:
  458. //      Gets the real values from the nodes and sets the UI based
  459. //        on these values.  This procedure updates the custom extension.
  460. //
  461. {
  462.     int $useImage = (`getAttr "defaultRenderGlobals.outFormatControl"` != 1);
  463.     checkBoxGrp -edit 
  464.         -v1 (`getAttr "defaultRenderGlobals.outFormatControl"` == 2)
  465.         -enable $useImage
  466.         imageCheckBox;
  467.         
  468.     int $useExt = $useImage && `checkBoxGrp -q -v1 imageCheckBox`;
  469.     textFieldGrp -edit
  470.         -enable $useExt
  471.         -text `getAttr "defaultRenderGlobals.outFormatExt"` 
  472.         userExt;
  473. }
  474.  
  475. global proc updateFieldOptions ()
  476. //
  477. //  Procedure Name:
  478. //      updateFieldOptions
  479. //
  480. //  Description:
  481. //      Gets the real values from the nodes and sets the UI based
  482. //        on these values.  This procedure updates all of the field
  483. //        values.
  484. //
  485. {
  486.     int $fieldType = `getAttr defaultResolution.fields` + 1;
  487.     int $useFields = ($fieldType != 1);
  488.     int $autoInterlace = ($fieldType == 4);
  489.  
  490.     // Because of 123444, the ordering of the menu and the actual
  491.     // saved fields values are not the same, which is why the
  492.     // below convoluted code.
  493.     switch ($fieldType) {
  494.         case 1:
  495.             optionMenuGrp -edit -select 1 fieldMenu;
  496.             break;
  497.         case 2:
  498.         case 3:
  499.             optionMenuGrp -edit -select ($fieldType + 2) fieldMenu;
  500.             break;
  501.         case 4:
  502.         case 5:
  503.             optionMenuGrp -edit -select ($fieldType - 2) fieldMenu;
  504.             break;
  505.     }
  506.         
  507.  
  508.     optionMenuGrp -edit -enable $useFields fieldDominanceMenu;
  509.     int $oddFieldFirst = `getAttr defaultResolution.oddFieldFirst`;
  510.     int $whichDominance = $oddFieldFirst ? 1 : 2;
  511.     optionMenuGrp -edit -sl $whichDominance fieldDominanceMenu;
  512.  
  513.     if ($fieldType == 1 || $fieldType == 4)
  514.         radioButtonGrp -edit
  515.             -select (`getAttr defaultResolution.zerothScanline` + 1)
  516.             -enable 0
  517.             scanlineButtons;
  518.     else
  519.         radioButtonGrp -edit
  520.             -select (`getAttr defaultResolution.zerothScanline` + 1)
  521.             -enable 1
  522.             scanlineButtons;
  523.     
  524.     int $useCustom = 0;    
  525.     if (`getAttr "defaultRenderGlobals.fieldExtControl"` == 1)
  526.         radioButtonGrp -edit -select 1 fieldButton1;
  527.     else if (`getAttr "defaultRenderGlobals.fieldExtControl"` == 0) 
  528.         radioButtonGrp -edit -select 1 fieldButton2;
  529.     else {
  530.         radioButtonGrp -edit -select 1 fieldButton3;
  531.         $useCustom = 1;
  532.     }
  533.     
  534.     radioButtonGrp -edit -enable ($useFields && !$autoInterlace) fieldButton1;
  535.     radioButtonGrp -edit -enable ($useFields && !$autoInterlace) fieldButton2;
  536.     radioButtonGrp -edit -enable ($useFields && !$autoInterlace) fieldButton3;
  537.  
  538.     textFieldGrp -edit
  539.         -text `getAttr "defaultRenderGlobals.oddFieldExt"`
  540.         -enable ($useFields && $useCustom)
  541.         oddFieldExt;
  542.         
  543.     textFieldGrp -edit
  544.         -text `getAttr "defaultRenderGlobals.evenFieldExt"`
  545.         -enable ($useFields && $useCustom)
  546.         evenFieldExt;
  547. }
  548.  
  549. global proc updateResolution ()
  550. //
  551. //  Procedure Name:
  552. //      updateResolution
  553. //
  554. //  Description:
  555. //      Gets the real values from the nodes and sets the UI based
  556. //        on these values.  This procedure updates all of the resolution
  557. //        values.
  558. //
  559. {
  560.     int $width = `getAttr defaultResolution.width`;
  561.     int $height = `getAttr defaultResolution.height`;
  562.     float $aspect = `getAttr defaultResolution.deviceAspectRatio`;
  563.     int $resItem;
  564.     int $whichRes = 1; // use "Custom" if no match is found
  565.     string $allResNodes[] = `ls -type resolution`;
  566.  
  567.     global string   $gImageFormatData[];
  568.     global string   $gUserImageFormatData[];
  569.     int        $numResolutionPresets = size($gImageFormatData);
  570.     int        $numUserResolutionPresets = size($gUserImageFormatData);
  571.     int        $numResolutionNodePresets = size($allResNodes) - 1;
  572.     int        $resWidth;
  573.     int        $resHeight;
  574.     float    $resAspect;
  575.     int        $numTokens;
  576.     string    $tokens[];
  577.  
  578.     for ($resItem = 0; $resItem < $numResolutionPresets; $resItem++) {
  579.         string $item = $gImageFormatData[$resItem];
  580.         $numTokens = tokenize($item, $tokens);
  581.         if ($numTokens == 4) {
  582.             $resWidth = $tokens[1];
  583.             $resHeight = $tokens[2];
  584.             $resAspect = $tokens[3];
  585.             if ($width == $resWidth && $height == $resHeight
  586.                     && abs($aspect - $resAspect) < 0.001) {
  587.                 // We add _2_ to $resItem below: 1 because we're
  588.                 // skipping the first item (Custom) in the list, and 1
  589.                 // because the optionMenu items are numbered starting at 1,
  590.                 // but our list in $gImageFormatData is indexed starting at 0.
  591.                 $whichRes = $resItem + 2;
  592.                 break;
  593.             }
  594.         } else {
  595.             string $badFormatMsg
  596.                 = ("Found invalid image format description: \""
  597.                 + $item + "\" in imageFormats.mel");
  598.             warning $badFormatMsg;
  599.         }
  600.     }
  601.  
  602.     // If no match was found in the built-in resolutions,
  603.     // check out the user-defined ones
  604.     //
  605.     if ($whichRes == 1) {
  606.         for ($resItem = 0; $resItem < $numUserResolutionPresets; $resItem++) {
  607.             string $item = $gUserImageFormatData[$resItem];
  608.             $numTokens = tokenize($item, $tokens);
  609.             if ($numTokens == 4) {
  610.                 $resWidth = $tokens[1];
  611.                 $resHeight = $tokens[2];
  612.                 $resAspect = $tokens[3];
  613.                 if ($width == $resWidth && $height == $resHeight
  614.                         && abs($aspect - $resAspect) < 0.001) {
  615.                     $whichRes = $numResolutionPresets + $resItem + 2;
  616.                     break;
  617.                 }
  618.             } else {
  619.                 string $badFormatMsg
  620.                     = ("Found invalid image format description: \""
  621.                     + $item + "\" in userImageFormats.mel");
  622.                 warning $badFormatMsg;
  623.             }
  624.         }
  625.     }
  626.  
  627.     // If no match was found in the user-defined resolutions,
  628.     // see if there are any 'extra' resolution nodes in the scene.
  629.     //
  630.     if ($whichRes == 1) {
  631.         for ($resItem = 0; $resItem < $numResolutionNodePresets; $resItem++) {
  632.             //
  633.             // We assume the 0th item in the list of resolution nodes is
  634.             // the default one, which is created implicitly...
  635.             string $resNodeName = $allResNodes[$resItem + 1];
  636.  
  637.             $resWidth = `getAttr ($resNodeName + ".width")`;
  638.             $resHeight = `getAttr ($resNodeName + ".height")`;
  639.             $resAspect = `getAttr ($resNodeName + ".deviceAspectRatio")`;
  640.             if ($width == $resWidth && $height == $resHeight
  641.                     && abs($aspect - $resAspect) < 0.001) {
  642.                 // We add _2_ to $resItem below: 1 because we're
  643.                 // skipping the first item (Custom) in the list, and 1
  644.                 // because the optionMenu items are numbered starting at 1,
  645.                 // but our list in $gImageFormatData is indexed starting at 0.
  646.                 $whichRes = $numResolutionPresets
  647.                             + $numUserResolutionPresets + $resItem + 2;
  648.                 break;
  649.             }
  650.         }
  651.     }
  652.     optionMenuGrp -edit -sl $whichRes resolutionMenu;
  653.  
  654.     checkBoxGrp -edit -v1 `getAttr defaultResolution.aspectLock` aspectLockCheck;
  655.     intFieldGrp -edit -v1 $width resWidth;
  656.     intFieldGrp -edit -v1 $height resHeight;
  657.     floatFieldGrp -edit -v1 $aspect resRatio;
  658.     rgAdjustPixelAspect "defaultResolution";
  659.     checkBoxGrp -edit -v1 `getAttr defaultResolution.lockDeviceAspectRatio` ratioLockCheck;
  660. }
  661.  
  662. global proc updateRaytraceQuality ()
  663. //
  664. //  Procedure Name:
  665. //      updateRaytraceQuality
  666. //
  667. //  Description:
  668. //      Gets the real values from the nodes and sets the UI based
  669. //        on these values.  This procedure updates all of the quality
  670. //        values.
  671. //
  672. {
  673.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  674.     int $useRT = `getAttr ($rendQual[0] + ".enableRaytracing")`;
  675.     checkBoxGrp -edit -v1 $useRT raytraceCheck;
  676.  
  677.     intSliderGrp -edit -v `getAttr ($rendQual[0] + ".reflections")`
  678.         reflectionsField;
  679.  
  680.     intSliderGrp -edit -v `getAttr ($rendQual[0] + ".refractions")`
  681.         refractionsField;
  682.  
  683.     intSliderGrp -edit -v `getAttr ($rendQual[0] + ".shadows")`
  684.         shadowsField;
  685.  
  686.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".rayTraceBias")`
  687.         rayTraceBiasField;
  688.  
  689.     intSliderGrp -edit -enable $useRT reflectionsField;
  690.     intSliderGrp -edit -enable $useRT refractionsField;
  691.     intSliderGrp -edit -enable $useRT shadowsField;
  692.     floatSliderGrp -edit -enable $useRT rayTraceBiasField;
  693. }
  694.  
  695. global proc updateRenderQuality ()
  696. //
  697. //  Procedure Name:
  698. //      updateRenderQuality
  699. //
  700. //  Description:
  701. //      Gets the real values from the nodes and sets the UI based
  702. //        on these values.  This procedure updates all of the quality
  703. //        values.
  704. //
  705. {
  706.     if (!`columnLayout -exists rgQualityLayout`) {
  707.         return;
  708.     }
  709.  
  710.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  711.  
  712.     int $useBlur = `getAttr defaultRenderGlobals.motionBlur`;
  713.     int $blur2d = (`getAttr defaultRenderGlobals.motionBlurType` == 0);
  714.     int $enableMultiPixelFilter = false;
  715.     int $enableFilterAttrs = false;
  716.  
  717.     int $shadingSamples = `getAttr ($rendQual[0] + ".shadingSamples")`;
  718.     intSliderGrp -edit -v $shadingSamples shadingSamplesField;
  719.  
  720.     int $maxShadingSamples = `getAttr ($rendQual[0] + ".maxShadingSamples")`;
  721.     intSliderGrp -edit -v $maxShadingSamples maxShadingSamplesField;
  722.  
  723.     int $visibilitySamples = `getAttr ($rendQual[0] + ".visibilitySamples")`;
  724.     intSliderGrp -edit -v $visibilitySamples visSamplesField;
  725.  
  726.     int $maxVisibilitySamples
  727.         = `getAttr ($rendQual[0] + ".maxVisibilitySamples")`;
  728.     intSliderGrp -edit -v $maxVisibilitySamples maxVisSamplesField;
  729.  
  730.     int $particleSamples = `getAttr ($rendQual[0] + ".particleSamples")`;
  731.     intSliderGrp -edit -v $particleSamples particlesSamplesField;
  732.                 
  733.     //
  734.     // The edge AA settings go from 0-3 for Highest down to Low
  735.     // But we choose to display the menu items in _ascending_ order,
  736.     // for consistency with the order of presets.
  737.     // Thus we must remap the values here
  738.     //
  739.     int $edgeAA = `getAttr ($rendQual[0] + ".edgeAntiAliasing")`;
  740.     int $edgeMenuItem;
  741.     if ($edgeAA == 0) { // Highest
  742.         $edgeMenuItem = 4;
  743.     } else if ($edgeAA == 1) { // High
  744.         $edgeMenuItem = 3;
  745.     } else if ($edgeAA == 2) { // Medium
  746.         $edgeMenuItem = 2;
  747.     } else if ($edgeAA == 3) { // Low
  748.         $edgeMenuItem = 1;
  749.     }
  750.     optionMenuGrp -edit -sl $edgeMenuItem edgeMenu;
  751.  
  752.     int $useMultiPixelFilter
  753.         = `getAttr ($rendQual[0] + ".useMultiPixelFilter")`;
  754.     checkBoxGrp -edit -v1 $useMultiPixelFilter pixelCheck;
  755.  
  756.  
  757.     //
  758.     // Check against the contrast threshold values.  The below
  759.     // tolerance check is due to MEL's poor numerical accuracy.
  760.     // E.g., setting a 0.4 value will not result in a 0.4 setting.
  761.     //
  762.     float $numerialTol = 0.001;
  763.     float $highContrastRed = 0.4;
  764.     float $highContrastGreen = 0.3;
  765.     float $highContrastBlue = 0.6;
  766.     float $lowContrastRed = 0.2;
  767.     float $lowContrastGreen = 0.15;
  768.     float $lowContrastBlue = 0.3;
  769.  
  770.     float $redTol = `getAttr ($rendQual[0] + ".redThreshold")`;
  771.     float $greenTol = `getAttr ($rendQual[0] + ".greenThreshold")`;
  772.     float $blueTol = `getAttr ($rendQual[0] + ".blueThreshold")`;
  773.  
  774.     float $redDiff = $redTol - $highContrastRed;
  775.     float $greenDiff = $greenTol - $highContrastGreen;
  776.     float $blueDiff = $blueTol - $highContrastBlue;
  777.     int $highContrast = $redDiff < $numerialTol && $redDiff > -$numerialTol &&
  778.                         $greenDiff < $numerialTol && $greenDiff > -$numerialTol &&
  779.                         $blueDiff < $numerialTol && $blueDiff > -$numerialTol;
  780.     
  781.     $redDiff = $redTol - $lowContrastRed;
  782.     $greenDiff = $greenTol - $lowContrastGreen;
  783.     $blueDiff = $blueTol - $lowContrastBlue;
  784.     int $lowContrast = $redDiff < $numerialTol && $redDiff > -$numerialTol &&
  785.                        $greenDiff < $numerialTol && $greenDiff > -$numerialTol &&
  786.                        $blueDiff < $numerialTol && $blueDiff > -$numerialTol;
  787.  
  788.  
  789.     //
  790.     // See if the current settings of the 6 attributes we just queried
  791.     // match any preset settings, and set the Presets menu state
  792.     // accordingly
  793.     //
  794.     if ($shadingSamples == 1 && $maxShadingSamples == 1
  795.             && $visibilitySamples == 1 && $maxVisibilitySamples == 4
  796.             && $edgeAA == 3  && $useMultiPixelFilter == 0 && $highContrast) {
  797.         optionMenuGrp -edit -sl 2 qualityPresetMenu; // Preview Quality
  798.     } else if ($shadingSamples == 1 && $maxShadingSamples == 8
  799.             && $visibilitySamples == 1 && $maxVisibilitySamples == 4
  800.             && $edgeAA == 0  && $useMultiPixelFilter == 0 && $highContrast) {
  801.         optionMenuGrp -edit -sl 3 qualityPresetMenu; // Intermediate Quality
  802.     } else if ($shadingSamples == 2 && $maxShadingSamples == 8
  803.             && $visibilitySamples == 1 && $maxVisibilitySamples == 4
  804.             && $edgeAA == 0  && $useMultiPixelFilter == 1 && $highContrast) {
  805.         optionMenuGrp -edit -sl 4 qualityPresetMenu; // Production Quality
  806.     } else if ($shadingSamples == 2 && $maxShadingSamples == 8
  807.             && $visibilitySamples == 1 && $maxVisibilitySamples == 4
  808.             && $edgeAA == 0  && $useMultiPixelFilter == 1 && $lowContrast) {
  809.         optionMenuGrp -edit -sl 5 qualityPresetMenu; // Contrast Sensitive Production Quality
  810.     } else if ($shadingSamples == 3 && $maxShadingSamples == 8
  811.             && $visibilitySamples == 1 && $maxVisibilitySamples == 4
  812.             && $edgeAA == 0  && $useMultiPixelFilter == 1 && $highContrast) {
  813.         optionMenuGrp -edit -sl 6 qualityPresetMenu; // Motion Blur Production
  814.     } else {
  815.         optionMenuGrp -edit -sl 1 qualityPresetMenu; // custom
  816.     }
  817.  
  818.     int $filterType = `getAttr ($rendQual[0] + ".pixelFilterType")`;
  819.     if ($filterType == 0) { // Box Filter
  820.         optionMenuGrp -edit -sl 1 pixelFilterMenu;
  821.     } else if ($filterType == 2) { // Triangle Filter
  822.         optionMenuGrp -edit -sl 2 pixelFilterMenu;
  823.     } else if ($filterType == 4) { // Gaussian Filter
  824.         optionMenuGrp -edit -sl 3 pixelFilterMenu;
  825.     } else if ($filterType == 5) { // Quadratic B-Spline Filter
  826.         optionMenuGrp -edit -sl 4 pixelFilterMenu;
  827.     } else if ($filterType == 1000) { // Plug-in Filter
  828.         optionMenuGrp -edit -sl 5 pixelFilterMenu;
  829.     }
  830.  
  831.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".pixelFilterWidthX")`
  832.         filterXField;
  833.  
  834.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".pixelFilterWidthY")`
  835.         filterYField;
  836.  
  837.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".redThreshold")`
  838.         contrastRedField;
  839.  
  840.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".greenThreshold")`
  841.         contrastGreenField;
  842.  
  843.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".blueThreshold")`
  844.         contrastBlueField;
  845.  
  846.     floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".coverageThreshold")`
  847.         -enable ($useBlur && !$blur2d) contrastCoverField;
  848.  
  849.     optionMenuGrp -edit -enable $useMultiPixelFilter pixelFilterMenu;
  850.     floatSliderGrp -edit -enable $useMultiPixelFilter filterXField;
  851.     floatSliderGrp -edit -enable $useMultiPixelFilter filterYField;
  852.  
  853.     // Now dim out items that are not applicable,
  854.     // based on the current settings
  855.  
  856.     if ($edgeAA == 3) { // Low
  857.         checkBoxGrp -edit -enable false pixelCheck;
  858.         optionMenuGrp -edit -enable false pixelFilterMenu;
  859.         floatSliderGrp -edit -enable false filterXField;
  860.         floatSliderGrp -edit -enable false filterYField;
  861.         floatSliderGrp -edit -enable false contrastRedField;
  862.         floatSliderGrp -edit -enable false contrastGreenField;
  863.         floatSliderGrp -edit -enable false contrastBlueField;
  864.         intSliderGrp -edit -enable false maxShadingSamplesField;
  865.         intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
  866.         intSliderGrp -edit -enable false maxVisSamplesField;
  867.     } else if ($edgeAA == 2) { // Medium
  868.         checkBoxGrp -edit -enable false pixelCheck;
  869.         optionMenuGrp -edit -enable false pixelFilterMenu;
  870.         floatSliderGrp -edit -enable false filterXField;
  871.         floatSliderGrp -edit -enable false filterYField;
  872.         floatSliderGrp -edit -enable false contrastRedField;
  873.         floatSliderGrp -edit -enable false contrastGreenField;
  874.         floatSliderGrp -edit -enable false contrastBlueField;
  875.         intSliderGrp -edit -enable false maxShadingSamplesField;
  876.         intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
  877.         intSliderGrp -edit -enable false maxVisSamplesField;
  878.     } else if ($edgeAA == 1) { // High
  879.         $enableMultiPixelFilter = true;
  880.         floatSliderGrp -edit -enable false contrastRedField;
  881.         floatSliderGrp -edit -enable false contrastGreenField;
  882.         floatSliderGrp -edit -enable false contrastBlueField;
  883.         intSliderGrp -edit -enable false maxShadingSamplesField;
  884.         intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
  885.         intSliderGrp -edit -enable false maxVisSamplesField;
  886.     } else if ($edgeAA == 0) { // Highest
  887.         $enableMultiPixelFilter = true;
  888.         floatSliderGrp -edit -enable true contrastRedField;
  889.         floatSliderGrp -edit -enable true contrastGreenField;
  890.         floatSliderGrp -edit -enable true contrastBlueField;
  891.         intSliderGrp -edit -enable true maxShadingSamplesField;
  892.         intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
  893.         intSliderGrp -edit -enable ($useBlur && !$blur2d) maxVisSamplesField;
  894.     }
  895.     if ($enableMultiPixelFilter) {
  896.         $enableFilterAttrs = `getAttr ($rendQual[0] + ".useMultiPixelFilter")`;
  897.     }
  898.     checkBoxGrp -edit -enable $enableMultiPixelFilter pixelCheck;
  899.     optionMenuGrp -edit -enable $enableFilterAttrs pixelFilterMenu;
  900.     floatSliderGrp -edit -enable $enableFilterAttrs filterXField;
  901.     floatSliderGrp -edit -enable $enableFilterAttrs filterYField;
  902. }
  903.  
  904. global proc updateMotionBlur ()
  905. //
  906. //  Procedure Name:
  907. //      updateMotionBlur
  908. //
  909. //  Description:
  910. //      Gets the real values from the nodes and sets the UI based
  911. //        on these values.  This procedure updates all of the motion
  912. //        blur values.
  913. //
  914.     int $useBlur = `getAttr defaultRenderGlobals.motionBlur`;
  915.     checkBoxGrp -edit -v1 $useBlur blurCheck;
  916.  
  917.     int $blur2d = (`getAttr defaultRenderGlobals.motionBlurType` == 0);
  918.     if ($blur2d) {
  919.         radioButtonGrp -edit -select 1 blurButton1;
  920.     } else {
  921.         radioButtonGrp -edit -select 1 blurButton2;
  922.     }
  923.  
  924.     radioButtonGrp -edit -enable $useBlur blurButton1;
  925.     radioButtonGrp -edit -enable $useBlur blurButton2;
  926.  
  927.     int $keepMotionVector = (`getAttr defaultRenderGlobals.keepMotionVector` == 1);
  928.     if ($useBlur && $blur2d && $keepMotionVector) {
  929.         global string $imgExt[];  // This is the actual file extension
  930.         global int $imgExtNum[];  // This is the corresponding internal value
  931.  
  932.         string $imageFormatExt = "";
  933.  
  934.         int $imageFormatNum = `getAttr defaultRenderGlobals.imageFormat`;
  935.  
  936.         // Get the corresponding imgExt for this imageFormat.
  937.  
  938.         for ($i = 0; $i < size($imgExtNum); $i += 1) {
  939.             if ($imageFormatNum == $imgExtNum[$i]) {
  940.                 $imageFormatExt = $imgExt[$i];
  941.                 break;
  942.             }
  943.         }
  944.  
  945.         // Check if the image format is not IFF.
  946.         //
  947.         // Note: there are two IFF image types. One for 8 bit images
  948.         // and one for 16 bit images. They both have an imgExt of iff.
  949.  
  950.         if ($imageFormatExt != "iff" ) {
  951.             warning
  952.                 ("Non-IFF image formats are not supported when writing"+
  953.                  " 2D motion vectors; setting image format to IFF");
  954.  
  955.             // Set globals imageFormat to Maya IFF
  956.             setAttr defaultRenderGlobals.imageFormat 7;
  957.         }
  958.     }
  959.  
  960.     floatFieldGrp -edit
  961.         -v1 `getAttr defaultRenderGlobals.motionBlurByFrame`
  962.         -enable $useBlur
  963.         blurFrameField;
  964.  
  965.     floatSliderGrp -edit
  966.         -v `getAttr defaultRenderGlobals.blurLength`
  967.         -enable ($useBlur && $blur2d)
  968.         blurLengthField;
  969.  
  970.     floatSliderGrp -edit
  971.         -v `getAttr defaultRenderGlobals.blurSharpness`
  972.         -enable ($useBlur && $blur2d)
  973.         blurSharpField;
  974.  
  975.     intFieldGrp -edit
  976.         -v1 `getAttr defaultRenderGlobals.smoothValue`
  977.         -enable ($useBlur && $blur2d)
  978.         blurSmoothField;
  979.  
  980.     int $smoothColor = `getAttr defaultRenderGlobals.smoothColor`;
  981.     radioButtonGrp -edit
  982.         -enable ($useBlur && $blur2d)
  983.         -select ($smoothColor + 1)
  984.         blurSmoothRadio;
  985.  
  986.     checkBoxGrp -edit
  987.         -v1 `getAttr defaultRenderGlobals.keepMotionVector`
  988.         -enable ($useBlur && $blur2d)
  989.         blurVectorCheck;
  990.  
  991.     int $useMemoryCap = `getAttr defaultRenderGlobals.useBlur2DMemoryCap`;
  992.     checkBoxGrp -edit
  993.         -v1 $useMemoryCap
  994.         -enable ($useBlur && $blur2d)
  995.         blurMemoryCapCheck;
  996.  
  997.     floatFieldGrp -edit
  998.         -v1 `getAttr defaultRenderGlobals.blur2DMemoryCap`
  999.         -enable ($useBlur && $blur2d && $useMemoryCap)
  1000.         blurMemoryCapField;
  1001.  
  1002. }
  1003.  
  1004. global proc createMotionBlur (string $parent) 
  1005. //
  1006. //  Procedure Name:
  1007. //      createMotionBlur
  1008. //
  1009. //  Description:
  1010. //      Creates the UI in the "Motion Blur" expand/collapse section.
  1011. //
  1012. {
  1013.     setUITemplate -pushTemplate attributeEditorTemplate;
  1014.  
  1015.     setParent $parent;
  1016.     string $cName;
  1017.  
  1018.     // If the UI is created already then just update attribute values.
  1019.     if (`columnLayout -exists rgBlurLayout`) {
  1020.         updateMotionBlur;
  1021.         return;
  1022.     }
  1023.  
  1024.     columnLayout -adjustableColumn true rgBlurLayout;
  1025.        
  1026.         checkBoxGrp -numberOfCheckBoxes 1
  1027.             -label1 "Motion Blur"
  1028.             -cc "setAttr defaultRenderGlobals.motionBlur #1; updateMotionBlur; updateRenderQuality;"
  1029.             blurCheck;
  1030.         scriptJob -p $parent 
  1031.             -ac "defaultRenderGlobals.motionBlur" 
  1032.             "updateMotionBlur; updateRenderQuality;";
  1033.  
  1034.         radioButtonGrp -numberOfRadioButtons 1
  1035.             -label "Motion Blur Type"
  1036.             -label1 "2D" 
  1037.             -onc "setAttr defaultRenderGlobals.motionBlurType 0"
  1038.             blurButton1;
  1039.         radioButtonGrp -numberOfRadioButtons 1
  1040.             -shareCollection blurButton1
  1041.             -label ""
  1042.             -label1 "3D" 
  1043.             -onc "setAttr defaultRenderGlobals.motionBlurType 1"
  1044.             blurButton2;
  1045.         // Any time the motion blur type changes we also need to call
  1046.         // updateMotionBlur and updateRenderQuality. This is done through
  1047.         // a script job watching for an attribute change.
  1048.         scriptJob -p $parent 
  1049.             -ac "defaultRenderGlobals.motionBlurType" 
  1050.             "updateMotionBlur; updateRenderQuality;";
  1051.  
  1052.         $cName = `floatFieldGrp -label "Blur by Frame"
  1053.             -cc "setAttr defaultRenderGlobals.motionBlurByFrame #1"
  1054.             blurFrameField`;
  1055.         connectControl -index 2 $cName "defaultRenderGlobals.motionBlurByFrame";
  1056.  
  1057.         $cName = `floatSliderGrp -label "Blur Length"
  1058.             -fieldMaxValue 100
  1059.             -minValue 0
  1060.             -maxValue 30
  1061.             -cc "setAttr defaultRenderGlobals.blurLength #1"
  1062.             blurLengthField`;
  1063.         connectControl $cName "defaultRenderGlobals.blurLength";
  1064.  
  1065.         $cName = `floatSliderGrp -label "Blur Sharpness"
  1066.             -fieldMaxValue 100
  1067.             -minValue 0
  1068.             -maxValue 15
  1069.             -cc "setAttr defaultRenderGlobals.blurSharpness #1"
  1070.             blurSharpField`;
  1071.         connectControl $cName "defaultRenderGlobals.blurSharpness";
  1072.  
  1073.         $cName = `radioButtonGrp -label "Smooth"
  1074.             -numberOfRadioButtons 2
  1075.             -label1 "Alpha"
  1076.             -label2 "Color"
  1077.             -on1 "setAttr defaultRenderGlobals.smoothColor 0"
  1078.             -on2 "setAttr defaultRenderGlobals.smoothColor 1"
  1079.             blurSmoothRadio`;
  1080.         scriptJob -p $parent 
  1081.             -ac "defaultRenderGlobals.smoothColor" "updateMotionBlur";
  1082.  
  1083.         $cName = `intFieldGrp -label "Smooth Value"
  1084.             -cc "setAttr defaultRenderGlobals.smoothValue #1"
  1085.             blurSmoothField`;
  1086.         connectControl -index 2 $cName "defaultRenderGlobals.smoothValue";
  1087.  
  1088.         $cName = `checkBoxGrp -numberOfCheckBoxes 1
  1089.             -label1 "Keep Motion Vectors"
  1090.             -cc "setAttr defaultRenderGlobals.keepMotionVector #1"
  1091.             blurVectorCheck`;
  1092.         connectControl -index 2 $cName "defaultRenderGlobals.keepMotionVector";
  1093.  
  1094.         $cName = `checkBoxGrp -numberOfCheckBoxes 1
  1095.             -label1 "Use 2d Blur Memory Limit"
  1096.             -cc "setAttr defaultRenderGlobals.useBlur2DMemoryCap #1; updateMotionBlur"
  1097.             blurMemoryCapCheck`;
  1098.         connectControl -index 2 $cName "defaultRenderGlobals.useBlur2DMemoryCap";
  1099.  
  1100.         $cName = `floatFieldGrp -label "2d Blur Memory Limit"  
  1101.             -extraLabel "MB" -cal 3 "left"
  1102.             -cc "setAttr defaultRenderGlobals.blur2DMemoryCap #1"
  1103.             blurMemoryCapField`;
  1104.         connectControl -index 2 $cName "defaultRenderGlobals.blur2DMemoryCap";
  1105.         
  1106.  
  1107.     setParent ..;
  1108.     setUITemplate -popTemplate;
  1109.  
  1110.     // Make sure the values are right
  1111.     updateMotionBlur;
  1112. }
  1113.  
  1114.  
  1115. global proc updateRenderOptions ()
  1116. //
  1117. //  Procedure Name:
  1118. //      updateRenderOptions
  1119. //
  1120. //  Description:
  1121. //      Gets the real values from the nodes and sets the UI based
  1122. //        on these values.  This procedure updates all of the options
  1123. //        values.
  1124. //
  1125.  
  1126. //  How do we get the value for this?
  1127. //    textFieldButtonGrp -edit
  1128. //        fogField;
  1129.  
  1130.     string $pluginFormat = `getAttr defaultRenderGlobals.pluginFormat`;
  1131.     textFieldGrp -edit -text $pluginFormat
  1132.         plugInFormat;
  1133.     
  1134.     string $preRenderMel = `getAttr defaultRenderGlobals.preRenderMel`;
  1135.     textFieldGrp -edit -text $preRenderMel
  1136.         preRenderMel;
  1137.     
  1138.     string $postRenderMel = `getAttr defaultRenderGlobals.postRenderMel`;
  1139.     textFieldGrp -edit -text $postRenderMel
  1140.         postRenderMel;
  1141.  
  1142.     checkBoxGrp -edit
  1143.         -v1 `getAttr "defaultRenderGlobals.enableDepthMaps"`
  1144.         depthMapCheck;
  1145.  
  1146.     checkBoxGrp -edit
  1147.         -v1 `getAttr "defaultRenderGlobals.enableDefaultLight"`
  1148.         defaultLightCheck;
  1149.  
  1150.     checkBoxGrp -edit
  1151.         -v1 `getAttr "defaultRenderGlobals.ignoreFilmGate"`
  1152.         filmGateCheck;
  1153.  
  1154.     checkBoxGrp -edit
  1155.         -v1 `getAttr "defaultRenderGlobals.clipFinalShadedColor"`
  1156.         clipCheck;
  1157.  
  1158.     checkBoxGrp -edit
  1159.         -v1 `getAttr "defaultRenderGlobals.jitterFinalColor"`
  1160.         jitterColor;
  1161.  
  1162.     checkBoxGrp -edit
  1163.         -v1 `getAttr "defaultRenderGlobals.composite"`
  1164.         compCheck;
  1165.  
  1166.     if (`isTrue MayaCreatorExists`) {
  1167.         checkBoxGrp -edit
  1168.             -v1 `getAttr "defaultRenderGlobals.applyFogInPost"`
  1169.             applyFogInPostCheck;
  1170.  
  1171.         intFieldGrp -edit
  1172.             -v1 `getAttr "defaultRenderGlobals.postFogBlur"`
  1173.             postFogBlurField;
  1174.     }
  1175.  
  1176.     checkBoxGrp -edit
  1177.         -v1 `getAttr "defaultRenderGlobals.shadowsObeyLightLinking"`
  1178.         shadowLightLinkCheck;
  1179.         
  1180.     floatFieldGrp -edit
  1181.         -v1 `getAttr "defaultRenderGlobals.compositeThreshold"`
  1182.         -enable `checkBoxGrp -q -v1 compCheck`
  1183.         compValueField;
  1184.  
  1185.     floatFieldGrp -edit
  1186.         -v1 `getAttr "defaultRenderGlobals.gammaCorrection"`
  1187.         gammaField;
  1188. }
  1189.  
  1190.  
  1191. //==================================================================
  1192. //
  1193. // Starting the data changing section
  1194. //
  1195. //==================================================================
  1196.  
  1197.  
  1198. global proc changeFileName ()
  1199. //
  1200. //  Procedure Name:
  1201. //      changeFileName
  1202. //
  1203. //  Description:
  1204. //        This procedure is called when the user changes the file
  1205. //        prefix.  It sets the internal representation of the prefix
  1206. //        and then updates the example to show the changes.
  1207. //
  1208. {
  1209.     string $prefix = `textFieldGrp -query -text fileName`;
  1210.     if ($prefix != "(not set; using filename)"
  1211.             && validFileNamePrefix($prefix)) {
  1212.         string $globalsAttr = "defaultRenderGlobals.imageFilePrefix";
  1213.         setAttr $globalsAttr -type "string" $prefix;
  1214.     }
  1215.  
  1216.     updateImageFile;
  1217.     updateFileOutputFeedback;
  1218. }
  1219.  
  1220. global proc changeExtension ()
  1221. //
  1222. //  Procedure Name:
  1223. //      changeExtension
  1224. //
  1225. //  Description:
  1226. //        This procedure is called when the user changes the format
  1227. //        of the file extension.  It sets the internal representation 
  1228. //        and then updates the example to show the changes.
  1229. //
  1230. //    Note:
  1231. //        Although the user sees only one control to change the
  1232. //        extension, it actually affects more than one value.
  1233. //
  1234. {
  1235.     global string $imgExt[];  // This is the actual file extension
  1236.     global int $imgExtNum[];  // This is the corresponding internal value
  1237.  
  1238.     int $item = `optionMenuGrp -q -sl extMenu`;
  1239.     int $ext = `optionMenuGrp -q -sl imageMenu` - 1; 
  1240.     int $multiframe = multiframeFormat($imgExt[$ext]);
  1241.     
  1242.     // print ("changeExtension to " + $ext + " " + $imgExt[$ext] + "\nmultiframe " + $multiframe + "\n" );
  1243.     {
  1244.         //
  1245.         // "name"
  1246.         //
  1247.         if ($item == 1) {
  1248.             // Animation off
  1249.             setAttr defaultRenderGlobals.animation 0;
  1250.             // No image file format type        
  1251.             setAttr defaultRenderGlobals.outFormatControl 1;    
  1252.             setAttr "defaultRenderGlobals.periodInExt" 1;
  1253.         //
  1254.         // "name.ext"
  1255.         //        
  1256.         } else if ($item == 2) {
  1257.             // Animation off
  1258.             setAttr defaultRenderGlobals.animation 0;            
  1259.             if (`checkBoxGrp -q -v1 imageCheckBox`) {
  1260.                 // Override image file format type
  1261.                 setAttr defaultRenderGlobals.outFormatControl 2;  
  1262.             } else {
  1263.                 // Standard image file format type
  1264.                 setAttr defaultRenderGlobals.outFormatControl 0;    
  1265.             }
  1266.             setAttr "defaultRenderGlobals.periodInExt" 1;
  1267.         //
  1268.         // "name.#.ext"
  1269.         //
  1270.         } else if ($item == 3) {
  1271.             // Animation on
  1272.             setAttr defaultRenderGlobals.animation 1; 
  1273.             if (`checkBoxGrp -q -v1 imageCheckBox`) {
  1274.                 // Override image file format type
  1275.                 setAttr defaultRenderGlobals.outFormatControl 2;  
  1276.             } else {
  1277.                 // Standard image file format type
  1278.                 setAttr defaultRenderGlobals.outFormatControl 0;    
  1279.             }
  1280.             setAttr "defaultRenderGlobals.putFrameBeforeExt" 1;
  1281.             setAttr "defaultRenderGlobals.periodInExt" 1;
  1282.         //
  1283.         // "name.ext.#"
  1284.         //
  1285.         } else if ($item == 4) {
  1286.             // Animation on
  1287.             setAttr defaultRenderGlobals.animation 1;
  1288.             if (`checkBoxGrp -q -v1 imageCheckBox`) {
  1289.                 // Override image file format type
  1290.                 setAttr defaultRenderGlobals.outFormatControl 2;  
  1291.             } else {
  1292.                 // Standard image file format type
  1293.                 setAttr defaultRenderGlobals.outFormatControl 0;    
  1294.             }
  1295.             setAttr "defaultRenderGlobals.putFrameBeforeExt" 0;
  1296.             setAttr "defaultRenderGlobals.periodInExt" 1;
  1297.         //
  1298.         // "name.#"
  1299.         //
  1300.         } else if ($item == 5) {
  1301.             // Animation on
  1302.             setAttr defaultRenderGlobals.animation 1;
  1303.             // No image file format type
  1304.             setAttr defaultRenderGlobals.outFormatControl 1;
  1305.             setAttr "defaultRenderGlobals.periodInExt" 1;
  1306.         //
  1307.         // "name#.ext"
  1308.         //
  1309.         } else if ($item == 6) {
  1310.             // Animation on
  1311.             setAttr defaultRenderGlobals.animation 1;
  1312.             if (`checkBoxGrp -q -v1 imageCheckBox`) {
  1313.                 // Override image file format type
  1314.                 setAttr defaultRenderGlobals.outFormatControl 2;
  1315.             } else {
  1316.                 // Standard image file format type
  1317.                 setAttr defaultRenderGlobals.outFormatControl 0;
  1318.             }
  1319.             setAttr "defaultRenderGlobals.putFrameBeforeExt" 1;
  1320.             setAttr "defaultRenderGlobals.periodInExt" 0;
  1321.         }
  1322.     }
  1323.  
  1324.     updateFrames;
  1325.     updateExtOptions;
  1326.     updateFileOutputFeedback;
  1327.  
  1328.     // Also update the main render window if it exists.
  1329.     if (`exists updateMainRenderMenu`) {
  1330.         updateMainRenderMenu();
  1331.     }
  1332.     // And the batch render window    
  1333.     if (`exists updateBatchRenderWindowTitle`) {
  1334.         updateBatchRenderWindowTitle();
  1335.     }
  1336. }
  1337.  
  1338. global proc changeImageFormat ()
  1339. //
  1340. //  Procedure Name:
  1341. //      changeImageFormat
  1342. //
  1343. //  Description:
  1344. //        This procedure is called when the user changes the type of 
  1345. //        image that will be written out.  It sets the internal 
  1346. //        representation and then updates the example to show the changes.
  1347. //
  1348. {
  1349.     global string $imgExt[];  // This is the actual file extension
  1350.     global int $imgExtNum[];  // This is the corresponding internal value
  1351.  
  1352.     int $item = `optionMenuGrp -q -sl imageMenu` - 1; 
  1353.     setAttr defaultRenderGlobals.imageFormat $imgExtNum[$item];
  1354.     updateFileOutputFeedback;
  1355.  
  1356.     // Check if the image format is IFF.
  1357.     //
  1358.     // Note: there are two IFF image types. One for 8 bit images
  1359.     // and one for 16 bit images. They both have an imgExt of iff.
  1360.  
  1361.     if ($imgExt[$item] != "iff") {
  1362.         int $useBlur = `getAttr defaultRenderGlobals.motionBlur`;
  1363.         int $blur2d = (`getAttr defaultRenderGlobals.motionBlurType` == 0);
  1364.         int $keepMotionVector = (`getAttr defaultRenderGlobals.keepMotionVector` == 1);
  1365.         if ($useBlur && $blur2d && $keepMotionVector) {
  1366.             warning
  1367.                 ("Non-IFF image formats are not supported when writing"+
  1368.                  " 2D motion vectors; setting image format to IFF");
  1369.  
  1370.             // Set globals imageFormat to Maya IFF
  1371.             setAttr defaultRenderGlobals.imageFormat 7;
  1372.         }
  1373.     }
  1374.  
  1375.     $item = `optionMenuGrp -q -sl imageMenu` - 1; 
  1376.     int $multiframe = multiframeFormat($imgExt[$item]);
  1377.  
  1378.     if ( $multiframe )
  1379.     {
  1380.         setAttr defaultRenderGlobals.animation 1;
  1381.     }
  1382.  
  1383.     updateFrames;
  1384.     updateExtOptions;
  1385.     updateFileOutputFeedback;
  1386.  
  1387.     // Also update the main render window if it exists.
  1388.     if (`exists updateMainRenderMenu`) {
  1389.         updateMainRenderMenu();
  1390.     }
  1391.     // And the batch render window    
  1392.     if (`exists updateBatchRenderWindowTitle`) {
  1393.         updateBatchRenderWindowTitle();
  1394.     }
  1395. }
  1396.  
  1397. global proc changeRenderObj ()
  1398. //
  1399. //  Procedure Name:
  1400. //      changeRenderObj
  1401. //
  1402. //  Description:
  1403. //        This procedure is called when the user changes the rendered 
  1404. //        objects.  It sets the internal representation.
  1405. //
  1406. {
  1407.     int $item = `optionMenuGrp -q -sl renderObjMenu`;
  1408.     if ($item == 1)
  1409.         setAttr defaultRenderGlobals.renderAll 1;
  1410.     else
  1411.         setAttr defaultRenderGlobals.renderAll 0;
  1412. }
  1413.  
  1414. global proc updateCameraAttrs ()
  1415. //
  1416. //  Procedure Name:
  1417. //      updateCameraAttrs
  1418. //
  1419. //  Description:
  1420. //        This procedure is called when the user changes attributes affecting
  1421. //        a camera.  It updates the corresponding attributes on the camera.
  1422. //
  1423. {
  1424.     int $camIndex = `optionMenuGrp -q -sl cameraMenu` - 1;
  1425.     string $allCameras[] = `ls -ca`;
  1426.     string $whichCamera = $allCameras[$camIndex];
  1427.     setAttr ($whichCamera + ".image") `checkBoxGrp -q -v1 rgbChannel`;
  1428.     setAttr ($whichCamera + ".mask") `checkBoxGrp -q -v1 alphaChannel`;
  1429.     setAttr ($whichCamera + ".depth") `checkBoxGrp -q -v1 depthChannel`;
  1430. }
  1431.  
  1432. global proc switchCamera ()
  1433. //
  1434. //  Procedure Name:
  1435. //      switchCamera
  1436. //
  1437. //  Description:
  1438. //        This procedure is called when the user changes the camera
  1439. //        that will be rendered.
  1440. //        It updates the controls for the new camera
  1441. //
  1442. {
  1443.     //
  1444.     // First count how many renderable cameras exist
  1445.     //
  1446.     string $allCameras[] = `ls -ca`;
  1447.     int $numRenderable = 0;
  1448.     for ($i = 0; $i < size($allCameras); $i++) {
  1449.         if (`getAttr ($allCameras[$i] + ".renderable")`) {
  1450.             $numRenderable++;
  1451.         }
  1452.     }
  1453.     int $camIndex = `optionMenuGrp -q -sl cameraMenu` - 1;
  1454.     if ($numRenderable < 2) {
  1455.         for ($i = 0; $i < size($allCameras); $i++) {
  1456.             if ($i == $camIndex) {
  1457.                 setAttr ($allCameras[$i] + ".renderable") 1;
  1458.             } else {
  1459.                 setAttr ($allCameras[$i] + ".renderable") 0;
  1460.             }
  1461.         }
  1462.     }
  1463.  
  1464.     string $whichCamera = $allCameras[$camIndex];
  1465.     checkBoxGrp -edit -v1 `getAttr ($whichCamera + ".image")` rgbChannel;
  1466.     checkBoxGrp -edit -v1 `getAttr ($whichCamera + ".mask")` alphaChannel;
  1467.     checkBoxGrp -edit -v1 `getAttr ($whichCamera + ".depth")` depthChannel;
  1468.     updateFileOutputFeedback;
  1469.  
  1470.     // Fix for 160069. The mental ray renderer and the Maya renderer
  1471.     // use the same renderable camera, so the mental ray render globals and
  1472.     // the Maya render globals must be kept in sync when the renderable camera
  1473.     // changes. The following code causes the attribute editor to be 
  1474.     // refreshed, just in case it contains the mental ray render globals.
  1475.     //
  1476.     global string $gAEFocusNode;
  1477.     updateAE($gAEFocusNode);
  1478. }
  1479.  
  1480. global proc changeCustomExtensionCheck ()
  1481. //
  1482. //  Procedure Name:
  1483. //      changeCustomExtensionCheck
  1484. //
  1485. //  Description:
  1486. //        This procedure is called when the user turns the custom 
  1487. //        extension on or off.  It sets the internal representation 
  1488. //        and then updates the example to show the changes.
  1489. //
  1490. {
  1491.     int $isOn = `checkBoxGrp -q -v1 imageCheckBox`;
  1492.     if ($isOn) {
  1493.         setAttr defaultRenderGlobals.outFormatControl 2;
  1494.     } else {
  1495.         // We have to figure out if there should be an extension
  1496.         // at all or not. 
  1497.         int $item = `optionMenuGrp -q -sl extMenu`;
  1498.         if ($item == 1 || $item == 5) {
  1499.             setAttr defaultRenderGlobals.outFormatControl 1;
  1500.         } else {
  1501.             setAttr defaultRenderGlobals.outFormatControl 0;
  1502.         }
  1503.     }   
  1504.  
  1505.     updateExtOptions;
  1506.     updateFileOutputFeedback;
  1507. }
  1508.  
  1509. global proc changeCustomExtensionName ()
  1510. //
  1511. //  Procedure Name:
  1512. //      changeCustomExtensionName
  1513. //
  1514. //  Description:
  1515. //        This procedure is called when the user specifies a custom 
  1516. //        extension.  It sets the internal representation 
  1517. //        and then updates the example to show the changes.
  1518. //
  1519. {
  1520.     setAttr -type "string" "defaultRenderGlobals.outFormatExt" `textFieldGrp -q -text userExt`;
  1521.     updateExtOptions;
  1522.     updateFileOutputFeedback;
  1523. }
  1524.  
  1525. global proc changeFrameExtension ()
  1526. //
  1527. //  Procedure Name:
  1528. //      changeFrameExtension
  1529. //
  1530. //  Description:
  1531. //        This procedure is called when the user overrides the 
  1532. //        frame numbers with new output numbers.  It sets the internal 
  1533. //        representation and then updates the example to show the changes.
  1534. //
  1535. {
  1536.     int $newValue = `intFieldGrp -q -v1 frameStartOverride`;
  1537.     if ($newValue < 0) {
  1538.         $newValue = 0;
  1539.         intFieldGrp -edit -v1 $newValue frameStartOverride;
  1540.         catch (warning("Value cannot be negative."));
  1541.     }
  1542.     setAttr "defaultRenderGlobals.startExtension" $newValue;
  1543.  
  1544.     $newValue = `intFieldGrp -q -v1 frameByOverride`;
  1545.     if ($newValue < 0) {
  1546.         $newValue = 0;
  1547.         intFieldGrp -edit -v1 $newValue frameByOverride;
  1548.         catch (warning("Value cannot be negative."));
  1549.     }
  1550.     setAttr "defaultRenderGlobals.byExtension" $newValue;
  1551.  
  1552.     updateFileOutputFeedback;
  1553. }
  1554.  
  1555. global proc changeFieldOptions ()
  1556. //
  1557. //  Procedure Name:
  1558. //      changeFieldOptions
  1559. //
  1560. //  Description:
  1561. //        This procedure is called when the user changes any of the 
  1562. //        values for fields.  It sets the internal representation
  1563. //        and then updates the example to show the changes.
  1564. //
  1565. {
  1566.     // Note that we stored the fields values internally different
  1567.     // from what's presented in the menu.  That is why the below
  1568.     // convoluted case statement.  Sorry - see 123444.
  1569.     int $realFieldsValue = (`optionMenuGrp -q -sl fieldMenu` - 1);
  1570.     switch ($realFieldsValue) {
  1571.         case 0:
  1572.             setAttr "defaultResolution.fields" 0;
  1573.             break;
  1574.         case 1:
  1575.         case 2:
  1576.             setAttr "defaultResolution.fields" ($realFieldsValue + 2);
  1577.             break;
  1578.         case 3:
  1579.         case 4:
  1580.             setAttr "defaultResolution.fields" ($realFieldsValue - 2);
  1581.             break;
  1582.     }
  1583.  
  1584.  
  1585.     int $whichDominance = `optionMenuGrp -q -sl fieldDominanceMenu`;
  1586.     if ($whichDominance == 1) {
  1587.         setAttr "defaultResolution.oddFieldFirst" true;
  1588.     } else {
  1589.         setAttr "defaultResolution.oddFieldFirst" false;
  1590.     }
  1591.     setAttr "defaultResolution.zerothScanline"
  1592.         (`radioButtonGrp -q -sl scanlineButtons` -1);
  1593.     
  1594.     if (`radioButtonGrp -q -sl fieldButton1`) {
  1595.         setAttr "defaultRenderGlobals.fieldExtControl" 1;
  1596.     } else if (`radioButtonGrp -q -sl fieldButton2`) {
  1597.         setAttr "defaultRenderGlobals.fieldExtControl" 0; 
  1598.     } else {
  1599.         setAttr "defaultRenderGlobals.fieldExtControl" 2; 
  1600.     }
  1601.     
  1602.     string $test = `textFieldGrp -q -text oddFieldExt`;
  1603.     if (size($test) > 1) {
  1604.         catch (error ("Field extensions must be a single character."));
  1605.     } else {
  1606.         setAttr -type "string" "defaultRenderGlobals.oddFieldExt" $test;
  1607.     }
  1608.     
  1609.     $test = `textFieldGrp -q -text evenFieldExt`;
  1610.     if (size($test) > 1) {
  1611.         catch (error ("Field extensions must be a single character."));
  1612.     } else {
  1613.         setAttr -type "string" "defaultRenderGlobals.evenFieldExt"  $test;
  1614.     }
  1615.  
  1616.     updateFieldOptions;
  1617.     updateFileOutputFeedback;
  1618. }
  1619.  
  1620. global proc changeResolution ()
  1621. //
  1622. //  Procedure Name:
  1623. //      changeResolution
  1624. //
  1625. //  Description:
  1626. //        This procedure is called when the user selects a different
  1627. //        resolution.  It sets the internal representation
  1628. //        and then updates the example to show the changes.
  1629. //
  1630. {
  1631.     global string   $gImageFormatData[];
  1632.     global string   $gUserImageFormatData[];
  1633.     int        $numResolutionPresets = size($gImageFormatData);
  1634.     int        $numUserResolutionPresets = size($gUserImageFormatData);
  1635.     string $allResNodes[] = `ls -type resolution`;
  1636.     int        $numResolutionNodePresets = size($allResNodes) - 1;
  1637.     string    $tokens[];
  1638.     int        $resItem = `optionMenuGrp -q -sl resolutionMenu`; 
  1639.     int        $resWidth;
  1640.     int        $resHeight;
  1641.     float    $resAspect;
  1642.     string    $item;
  1643.  
  1644.     // Item #1 is Custom, which doesn't change the fields
  1645.     // We subtract _2_ from $resItem below: 1 because we're
  1646.     // skipping the first item (Custom) in the list, and 1
  1647.     // because the optionMenu items are numbered starting at 1,
  1648.     // but our list in $gImageFormatData is indexed starting at 0.
  1649.     //
  1650.     if ($resItem > 1) {
  1651.         if ($resItem > ($numResolutionPresets + 1)) {
  1652.             if ($resItem
  1653.                     > ($numResolutionPresets + $numUserResolutionPresets + 1)) {
  1654.                 // It's one of the user-defined resolution nodes' presets
  1655.                 string $resNodeName = $allResNodes[$resItem
  1656.                                                 - $numResolutionPresets
  1657.                                                 - $numUserResolutionPresets
  1658.                                                 - 1];
  1659.                 $resWidth = `getAttr ($resNodeName + ".width")`;
  1660.                 $resHeight = `getAttr ($resNodeName + ".height")`;
  1661.                 $resAspect = `getAttr ($resNodeName + ".deviceAspectRatio")`;
  1662.             } else {
  1663.                 // It's one of the user-defined resolution presets
  1664.                 $item = $gUserImageFormatData[$resItem
  1665.                     - $numResolutionPresets - 2];
  1666.                 int        $numTokens = tokenize($item, $tokens);
  1667.                 $resWidth = $tokens[1];
  1668.                 $resHeight = $tokens[2];
  1669.                 $resAspect = $tokens[3];
  1670.             }
  1671.         } else {
  1672.             // It's one of the built-in resolution presets
  1673.             $item = $gImageFormatData[$resItem - 2];
  1674.             int        $numTokens = tokenize($item, $tokens);
  1675.             $resWidth = $tokens[1];
  1676.             $resHeight = $tokens[2];
  1677.             $resAspect = $tokens[3];
  1678.         }
  1679.         setAttr "defaultResolution.width" $resWidth;
  1680.         setAttr "defaultResolution.height" $resHeight;
  1681.         setAttr "defaultResolution.deviceAspectRatio" $resAspect;
  1682.         setAttr "defaultResolution.lockDeviceAspectRatio" 1;
  1683.  
  1684.         // Set the proper field ordering if PAL or NTSC.
  1685.         if (`getAttr defaultResolution.height` == 576) { // PAL
  1686.             setAttr "defaultResolution.oddFieldFirst" 0;
  1687.             if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
  1688.         } else if (`getAttr defaultResolution.height` == 486) { // NTSC
  1689.             setAttr "defaultResolution.oddFieldFirst" 1;
  1690.             if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
  1691.         }
  1692.     }
  1693.  
  1694.     updateResolution;
  1695. }
  1696.  
  1697. global proc changeAspectLockWidth ()
  1698. //
  1699. //  Procedure Name:
  1700. //      changeAspectLockWidth
  1701. //
  1702. //  Description:
  1703. //        This procedure is called when the user changes the
  1704. //        resolution width.  It sets the internal representation
  1705. //        then looks at the ratio lock etc and changes any other 
  1706. //        values that rely on it. 
  1707. //
  1708. {
  1709.     int $requestedWidth = `intFieldGrp -q -v1 resWidth`;
  1710.     int $isMayaEvalVersion = `about -ev`;
  1711.     int $kPLEMaxX = 1024;
  1712.     int $kPLEMaxY =  768;
  1713.     if ( $isMayaEvalVersion ) {
  1714.         if( $requestedWidth > $kPLEMaxX ) {
  1715.             warning( "Image resolution is limited to "+$kPLEMaxX+"x"+$kPLEMaxY+" pixels for the Maya Personal Learning Edition" );
  1716.             $requestedWidth = $kPLEMaxX;
  1717.         }
  1718.         if( `getAttr defaultResolution.aspectLock` ) {
  1719.             float $aspect = `getAttr defaultResolution.pixelAspect`;
  1720.             if ( $aspect > 0.0 ){
  1721.                 int $rez = $aspect * $requestedWidth;
  1722.                 int $oldrez = `getAttr defaultResolution.height`;
  1723.                 if ($rez <= $kPLEMaxY) {
  1724.                     if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
  1725.                         setAttr defaultResolution.height $rez;
  1726.                     }
  1727.                 } else {
  1728.                     intFieldGrp -e -v1 $kPLEMaxY resHeight;
  1729.                     changeAspectLockHeight;
  1730.                     return;
  1731.                 }
  1732.             }
  1733.         }
  1734.     }
  1735.  
  1736.     if ($requestedWidth < 2) {
  1737.         warning "Width must be at least 2 pixels";
  1738.         $requestedWidth = 2;
  1739.     }
  1740.  
  1741.     setAttr defaultResolution.width $requestedWidth;
  1742.     optionMenuGrp -edit -sl 1 resolutionMenu;
  1743.     checkAspectLockWidth "defaultResolution";
  1744.  
  1745.     // Update the values
  1746.     updateResolution;
  1747. }
  1748.  
  1749. global proc changeAspectLockHeight ()
  1750. //
  1751. //  Procedure Name:
  1752. //      changeAspectLockHeight
  1753. //
  1754. //  Description:
  1755. //        This procedure is called when the user changes the
  1756. //        resolution width.  It sets the internal representation
  1757. //        then looks at the ratio lock etc and changes any other 
  1758. //        values that rely on it. 
  1759. //
  1760. {
  1761.     int $requestedHeight = `intFieldGrp -q -v1 resHeight`;
  1762.     int $isMayaEvalVersion = `about -ev`;
  1763.     int $kPLEMaxX = 1024;
  1764.     int $kPLEMaxY =  768;
  1765.     if ( $isMayaEvalVersion ) {
  1766.         if( $requestedHeight > $kPLEMaxY ) {
  1767.             warning( "Image resolution is limited to "+$kPLEMaxX+"x"+$kPLEMaxY+" pixels for the Maya Personal Learning Edition" );
  1768.             $requestedHeight = $kPLEMaxY;
  1769.         }
  1770.         if( `getAttr defaultResolution.aspectLock` ) {
  1771.             float $aspect = `getAttr defaultResolution.pixelAspect`;
  1772.             if ( $aspect > 0.0 ){
  1773.                 int $rez = $requestedHeight / $aspect;
  1774.                 int $oldrez = `getAttr defaultResolution.width`;
  1775.                 if ($rez <= $kPLEMaxX) {
  1776.                     if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
  1777.                         setAttr defaultResolution.width $rez;
  1778.                     }
  1779.                 } else {
  1780.                     intFieldGrp -e -v1 $kPLEMaxX resWidth;
  1781.                     changeAspectLockWidth;
  1782.                     return;
  1783.                 }
  1784.             }
  1785.         }
  1786.     }
  1787.  
  1788.     if ($requestedHeight < 2) {
  1789.         warning "Height must be at least 2 pixels";
  1790.         $requestedHeight = 2;
  1791.     }
  1792.  
  1793.     setAttr defaultResolution.height $requestedHeight;
  1794.     optionMenuGrp -edit -sl 1 resolutionMenu;
  1795.     checkAspectLockHeight "defaultResolution";
  1796.  
  1797.     // Set the proper field ordering if PAL or NTSC.
  1798.     if (`getAttr defaultResolution.height` == 576) { // PAL
  1799.         setAttr "defaultResolution.oddFieldFirst" 0;
  1800.         if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
  1801.     } else if (`getAttr defaultResolution.height` == 486) { // NTSC
  1802.         setAttr "defaultResolution.oddFieldFirst" 1;
  1803.         if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
  1804.     }
  1805.  
  1806.     // Update the values
  1807.     updateResolution;
  1808. }
  1809.  
  1810. //==================================================================
  1811. //
  1812. // Starting the UI creation section
  1813. //
  1814. //==================================================================
  1815.  
  1816. global proc createImageFile (string $parent) 
  1817. //
  1818. //  Procedure Name:
  1819. //      createImageFile
  1820. //
  1821. //  Description:
  1822. //      Creates the UI in the "Image File Output" expand/collapse section.
  1823. //        This section is always created so is treated differently
  1824. //        then the sections created when the tab is expanded.
  1825. //
  1826. {
  1827.     setUITemplate -pushTemplate attributeEditorTemplate;
  1828.  
  1829.     setParent $parent;
  1830.     string $cName;
  1831.     
  1832.     columnLayout -adjustableColumn true;
  1833.  
  1834.         textFieldGrp -label "File Name Prefix" -cc changeFileName fileName;
  1835.  
  1836.         // Extension ------------------------------------------------
  1837.  
  1838.         optionMenuGrp -label "Frame/Animation Ext" -cc changeExtension extMenu;
  1839.             menuItem -label "name (Single Frame)";
  1840.             menuItem -label "name.ext (Single Frame)";
  1841.             menuItem -label "name.#.ext";            
  1842.             menuItem -label "name.ext.#";    
  1843.             menuItem -label "name.#";    
  1844.             menuItem -label "name#.ext";
  1845.  
  1846.         // Frames numbers ------------------------------------------------
  1847.  
  1848.         floatFieldGrp -numberOfFields 1
  1849.             -label "Start Frame"
  1850.             -cc "setAttr defaultRenderGlobals.startFrame `floatFieldGrp -q -v1 startFrame`; updateFileOutputFeedback" 
  1851.             startFrame;
  1852.         scriptJob -p $parent 
  1853.             -ac "defaultRenderGlobals.startFrame" 
  1854.             "updateFrames; updateFileOutputFeedback;";
  1855.  
  1856.         floatFieldGrp -numberOfFields 1
  1857.             -label "End Frame"
  1858.             -cc "setAttr defaultRenderGlobals.endFrame `floatFieldGrp -q -v1 endFrame`; updateFileOutputFeedback" 
  1859.             endFrame;
  1860.         scriptJob -p $parent 
  1861.             -ac "defaultRenderGlobals.endFrame" 
  1862.             "updateFrames; updateFileOutputFeedback;";
  1863.  
  1864.         floatFieldGrp -numberOfFields 1
  1865.             -label "By Frame"
  1866.             -cc "setAttr defaultRenderGlobals.byFrameStep `floatFieldGrp -q -v1 frameStep`" 
  1867.             frameStep;
  1868.         scriptJob -p $parent 
  1869.             -ac "defaultRenderGlobals.byFrameStep" 
  1870.             "updateFrames; updateFileOutputFeedback;";
  1871.  
  1872.         intFieldGrp -numberOfFields 1
  1873.             -label "Frame Padding"
  1874.             -cc "setAttr defaultRenderGlobals.extensionPadding `intFieldGrp -q -v1 extPad`; updateFileOutputFeedback" 
  1875.             extPad;
  1876.         scriptJob -p $parent 
  1877.             -ac "defaultRenderGlobals.extensionPadding" 
  1878.             "updateFrames; updateFileOutputFeedback;";
  1879.     
  1880.         // Image Format ------------------------------------------------
  1881.  
  1882.         // These tables translate between the internal representation of the
  1883.         // image formats and the UI that is presented to the user.
  1884.         //
  1885.  
  1886.         // Fill up the above tables alphabetically.
  1887.         // NOTE !!!! WARNING !!!! NOTE !!!! WARNING !!!! NOTE !!!! WARNING !!!!
  1888.         // If you are changing one of the menuItem fields below or adding new ones or
  1889.         // whatever, be certain to also update the fields in the 'createImageFormats()'
  1890.         // procedure of createImageFormats.mel
  1891.  
  1892.         global string $imgExt[];
  1893.  
  1894.         if (size( $imgExt ) == 0) {
  1895.             // If the file format array has not been initialized yet, do so.
  1896.             // This routine may be called in dynPaintMenus.mel during the
  1897.             // file save for PFX canvas images.
  1898.             createImageFormats();
  1899.         }
  1900.  
  1901.            int $isMayaEvalVersion = `about -ev`;
  1902.  
  1903.         if ( $isMayaEvalVersion ) {
  1904.  
  1905.            if (`about -nt`) {
  1906.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  1907.             menuItem -label "Alias PIX (als)";      //  $imgExt[0]  = "als";  $imgExtNum[0]  =  6;
  1908.             menuItem -label "AVI (avi)";            //  $imgExt[1]  = "avi";  $imgExtNum[1]  = 23;
  1909.             menuItem -label "Cineon (cin)";         //  $imgExt[2]  = "cin";  $imgExtNum[2]  = 11;
  1910.             menuItem -label "EPS (eps)";            //  $imgExt[3]  = "eps";  $imgExtNum[3]  =  9;
  1911.             menuItem -label "GIF (gif)";            //  $imgExt[4]  = "gif";  $imgExtNum[4]  =  0;
  1912.             menuItem -label "JPEG (jpeg)";          //  $imgExt[5]  = "jpeg"; $imgExtNum[5]  =  8;
  1913.             menuItem -label "Maya IFF (iff)";       //  $imgExt[6]  = "iff";  $imgExtNum[6]  =  7;
  1914.             menuItem -label "Quantel (yuv)";        //  $imgExt[7]  = "yuv";  $imgExtNum[8]  = 12;
  1915.             menuItem -label "RLA (rla)";            //  $imgExt[8]  = "rla";  $imgExtNum[9]  =  2;
  1916.             menuItem -label "SGI (sgi)";            //  $imgExt[9]  = "sgi";  $imgExtNum[10] =  5;
  1917.             menuItem -label "SoftImage (pic)";      //  $imgExt[10] = "pic";  $imgExtNum[12] =  1;
  1918.             menuItem -label "Targa (tga)";          //  $imgExt[11] = "tga";  $imgExtNum[13] = 19;
  1919.             menuItem -label "Tiff (tif)";           //  $imgExt[12] = "tif";  $imgExtNum[14] =  3;
  1920.             menuItem -label "Windows Bitmap (bmp)"; //  $imgExt[13] = "bmp";  $imgExtNum[16] = 20;
  1921.            } else if (`about -irix`)  {
  1922.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  1923.             menuItem -label "Alias PIX (als)";        //  $imgExt[0]  = "als";  $imgExtNum[0]  =  6;
  1924.             menuItem -label "AVI (avi)";            //  $imgExt[1]  = "avi";  $imgExtNum[1]  = 23;
  1925.             menuItem -label "Cineon (cin)";            //  $imgExt[2]  = "cin";  $imgExtNum[2]  = 11;
  1926.             menuItem -label "EPS (eps)";            //  $imgExt[3]  = "eps";  $imgExtNum[3]  =  9;
  1927.             menuItem -label "GIF (gif)";            //  $imgExt[4]  = "gif";  $imgExtNum[4]  =  0;
  1928.             menuItem -label "JPEG (jpeg)";            //  $imgExt[5]  = "jpeg"; $imgExtNum[5]  =  8;
  1929.             menuItem -label "Maya IFF (iff)";          //  $imgExt[6]  = "iff";  $imgExtNum[6]  =  7;
  1930.             menuItem -label "Quantel (yuv)";        //  $imgExt[7]  = "yuv";  $imgExtNum[7]  = 12;
  1931.             menuItem -label "Quicktime (qt)";        //  $imgExt[8]  = "qt";   $imgExtNum[8]  = 22;
  1932.             menuItem -label "RLA (rla)";            //  $imgExt[9]  = "rla";  $imgExtNum[9]  =  2;
  1933.             menuItem -label "SGI (sgi)";            //  $imgExt[10] = "sgi";  $imgExtNum[10] =  5;
  1934.             menuItem -label "SGI Movie (mv)";        //  $imgExt[11] = "mv";   $imgExtNum[11] = 21;
  1935.             menuItem -label "SoftImage (pic)";        //  $imgExt[12] = "pic";  $imgExtNum[12] =  1;
  1936.             menuItem -label "Targa (tga)";            //  $imgExt[13] = "tga";  $imgExtNum[13] = 19;
  1937.             menuItem -label "Tiff (tif)";            //  $imgExt[14] = "tif";  $imgExtNum[14] =  3;
  1938.             menuItem -label "Windows Bitmap (bmp)";        //  $imgExt[15] = "bmp";  $imgExtNum[15] = 20; 
  1939.            } else if (`about -linux`)  {
  1940.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  1941.             menuItem -label "Alias PIX (als)";        //  $imgExt[0]  = "als";  $imgExtNum[0]  =  6;
  1942.             menuItem -label "Cineon (cin)";            //  $imgExt[1]  = "cin";  $imgExtNum[1]  = 11;
  1943.             menuItem -label "EPS (eps)";            //  $imgExt[2]  = "eps";  $imgExtNum[2]  =  9;
  1944.             menuItem -label "GIF (gif)";            //  $imgExt[3]  = "gif";  $imgExtNum[3]  =  0;
  1945.             menuItem -label "JPEG (jpeg)";            //  $imgExt[4]  = "jpeg"; $imgExtNum[4]  =  8;
  1946.             menuItem -label "Maya IFF (iff)";          //  $imgExt[5]  = "iff";  $imgExtNum[5]  =  7;
  1947.             menuItem -label "Quantel (yuv)";        //  $imgExt[6]  = "yuv";  $imgExtNum[6]  = 12;
  1948.             menuItem -label "RLA (rla)";            //  $imgExt[7]  = "rla";  $imgExtNum[7]  =  2;
  1949.             menuItem -label "SGI (sgi)";            //  $imgExt[8]  = "sgi";  $imgExtNum[8]  =  5;
  1950.             menuItem -label "SoftImage (pic)";        //  $imgExt[9]  = "pic";  $imgExtNum[9]  =  1;
  1951.             menuItem -label "Targa (tga)";            //  $imgExt[10] = "tga";  $imgExtNum[10] = 19;
  1952.             menuItem -label "Tiff (tif)";            //  $imgExt[11] = "tif";  $imgExtNum[11] =  3;
  1953.             menuItem -label "Windows Bitmap (bmp)";        //  $imgExt[12] = "bmp";  $imgExtNum[12] = 20; 
  1954.            } else if ( `about -mac` ) {
  1955.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  1956.             menuItem -label "JPEG (jpeg)";
  1957.             menuItem -label "Maya IFF (iff)";
  1958.             menuItem -label "MacPaint (pntg)";
  1959.             menuItem -label "Photoshop (ps)";
  1960.             menuItem -label "PNG (png)";
  1961.             menuItem -label "QuickDraw (pict)";
  1962.             menuItem -label "Quicktime Movie (qt)";
  1963.             menuItem -label "Quicktime Image (qtif)";
  1964.             menuItem -label "Silicon Graphics (sgi)";
  1965.             menuItem -label "Targa (tga)";
  1966.             menuItem -label "Tiff (tif)";
  1967.             menuItem -label "Windows Bitmap (bmp)";
  1968.            } else {
  1969.             warning "Unsupported platform in renderGlobalsWindow.mel";
  1970.            }
  1971.  
  1972.         } else {
  1973.  
  1974.         if (`about -nt`) {
  1975.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  1976.             menuItem -label "Alias PIX (als)";      //  $imgExt[0]  = "als";  $imgExtNum[0]  = 6;
  1977.             menuItem -label "AVI (avi)";            //  $imgExt[1]  = "avi";  $imgExtNum[1]  = 23;
  1978.             menuItem -label "Cineon (cin)";         //  $imgExt[2]  = "cin";  $imgExtNum[2]  = 11;
  1979.             menuItem -label "EPS (eps)";            //  $imgExt[3]  = "eps";  $imgExtNum[3]  = 9;
  1980.             menuItem -label "GIF (gif)";            //  $imgExt[4]  = "gif";  $imgExtNum[4]  = 0;
  1981.             menuItem -label "JPEG (jpeg)";          //  $imgExt[5]  = "jpeg"; $imgExtNum[5]  = 8;
  1982.             menuItem -label "Maya IFF (iff)";       //  $imgExt[6]  = "iff";  $imgExtNum[6]  = 7;
  1983.             menuItem -label "Maya16 IFF (iff)";     //  $imgExt[7]  = "iff";  $imgExtNum[7]  = 10;
  1984.             menuItem -label "Quantel (yuv)";        //  $imgExt[8]  = "yuv";  $imgExtNum[8]  = 12;
  1985.             menuItem -label "RLA (rla)";            //  $imgExt[9]  = "rla";  $imgExtNum[9]  = 2;
  1986.             menuItem -label "SGI (sgi)";            //  $imgExt[10] = "sgi";  $imgExtNum[10]  = 5;
  1987.             menuItem -label "SGI16 (sgi)";          //  $imgExt[11] = "sgi";  $imgExtNum[11] = 13;
  1988.             menuItem -label "SoftImage (pic)";      //  $imgExt[12] = "pic";  $imgExtNum[12] = 1;
  1989.             menuItem -label "Targa (tga)";          //  $imgExt[13] = "tga";  $imgExtNum[13] = 19;
  1990.             menuItem -label "Tiff (tif)";           //  $imgExt[14] = "tif";  $imgExtNum[14] = 3;
  1991.             menuItem -label "Tiff16 (tif)";         //  $imgExt[15] = "tif";  $imgExtNum[15] = 4;
  1992.             menuItem -label "Windows Bitmap (bmp)"; //  $imgExt[16] = "bmp";  $imgExtNum[16] = 20;
  1993.         } else if (`about -irix`)  {
  1994.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  1995.             menuItem -label "Alias PIX (als)";        //  $imgExt[0]  = "als";  $imgExtNum[0]  = 6;
  1996.             menuItem -label "AVI (avi)";            //  $imgExt[1]  = "avi";  $imgExtNum[1]  = 23;
  1997.             menuItem -label "Cineon (cin)";            //  $imgExt[2]  = "cin";  $imgExtNum[2]  = 11;
  1998.             menuItem -label "EPS (eps)";            //  $imgExt[3]  = "eps";  $imgExtNum[3]  = 9;
  1999.             menuItem -label "GIF (gif)";            //  $imgExt[4]  = "gif";  $imgExtNum[4]  = 0;
  2000.             menuItem -label "JPEG (jpeg)";            //  $imgExt[5]  = "jpeg"; $imgExtNum[5]  = 8;
  2001.             menuItem -label "Maya IFF (iff)";          //  $imgExt[6]  = "iff";  $imgExtNum[6]  = 7;
  2002.             menuItem -label "Maya16 IFF (iff)";        //  $imgExt[7]  = "iff";  $imgExtNum[7]  = 10;
  2003.             menuItem -label "Quantel (yuv)";        //  $imgExt[8]  = "yuv";  $imgExtNum[8]  = 12;
  2004.             menuItem -label "Quicktime (qt)";        //  $imgExt[9]  = "qt";   $imgExtNum[9]  = 22;
  2005.             menuItem -label "RLA (rla)";            //  $imgExt[10]  = "rla"; $imgExtNum[10]  = 2;
  2006.             menuItem -label "SGI (sgi)";            //  $imgExt[11] = "sgi";  $imgExtNum[11]  = 5;
  2007.             menuItem -label "SGI16 (sgi)";            //  $imgExt[12] = "sgi";  $imgExtNum[12] = 13;
  2008.             menuItem -label "SGI Movie (mv)";        //  $imgExt[13] = "mv";   $imgExtNum[13] = 21;
  2009.             menuItem -label "SoftImage (pic)";        //  $imgExt[14] = "pic";  $imgExtNum[14] = 1;
  2010.             menuItem -label "Targa (tga)";            //  $imgExt[15] = "tga";  $imgExtNum[15] = 19;
  2011.             menuItem -label "Tiff (tif)";            //  $imgExt[16] = "tif";  $imgExtNum[16] = 3;
  2012.             menuItem -label "Tiff16 (tif)";            //  $imgExt[17] = "tif";  $imgExtNum[17] = 4;
  2013.             menuItem -label "Windows Bitmap (bmp)";    //  $imgExt[18] = "bmp";  $imgExtNum[18] = 20;
  2014.         } else if (`about -linux`)  {
  2015.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  2016.             menuItem -label "Alias PIX (als)";        //  $imgExt[0]  = "als";  $imgExtNum[0]  = 6;
  2017.             menuItem -label "Cineon (cin)";            //  $imgExt[1]  = "cin";  $imgExtNum[1]  = 11;
  2018.             menuItem -label "EPS (eps)";            //  $imgExt[2]  = "eps";  $imgExtNum[2]  = 9;
  2019.             menuItem -label "GIF (gif)";            //  $imgExt[3]  = "gif";  $imgExtNum[3]  = 0;
  2020.             menuItem -label "JPEG (jpeg)";            //  $imgExt[4]  = "jpeg"; $imgExtNum[4]  = 8;
  2021.             menuItem -label "Maya IFF (iff)";          //  $imgExt[5]  = "iff";  $imgExtNum[5]  = 7;
  2022.             menuItem -label "Maya16 IFF (iff)";        //  $imgExt[6]  = "iff";  $imgExtNum[6]  = 10;
  2023.             menuItem -label "Quantel (yuv)";        //  $imgExt[7]  = "yuv";  $imgExtNum[7]  = 12;
  2024.             menuItem -label "RLA (rla)";            //  $imgExt[8]  = "rla";  $imgExtNum[8]  = 2;
  2025.             menuItem -label "SGI (sgi)";            //  $imgExt[9] = "sgi";   $imgExtNum[9]  = 5;
  2026.             menuItem -label "SGI16 (sgi)";            //  $imgExt[10] = "sgi";  $imgExtNum[10] = 13;
  2027.             menuItem -label "SoftImage (pic)";        //  $imgExt[11] = "pic";  $imgExtNum[11] = 1;
  2028.             menuItem -label "Targa (tga)";            //  $imgExt[12] = "tga";  $imgExtNum[12] = 19;
  2029.             menuItem -label "Tiff (tif)";            //  $imgExt[13] = "tif";  $imgExtNum[13] = 3;
  2030.             menuItem -label "Tiff16 (tif)";            //  $imgExt[14] = "tif";  $imgExtNum[14] = 4;
  2031.             menuItem -label "Windows Bitmap (bmp)";    //  $imgExt[15] = "bmp";  $imgExtNum[15] = 20;
  2032.         } else if ( `about -mac` ) {
  2033.             optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
  2034.             menuItem -label "JPEG (jpeg)";            //    $imgExt[0]  = "jpeg"; $imgExtNum[0]  = 8;
  2035.             menuItem -label "Maya IFF (iff)";          //    $imgExt[1]  = "iff";  $imgExtNum[1]  = 7;
  2036.             menuItem -label "Maya16 IFF (iff)";        //    $imgExt[2]  = "iff";  $imgExtNum[2]  = 10;
  2037.             menuItem -label "MacPaint (pntg)";          //    $imgExt[3]  = "pntg"; $imgExtNum[3]  = 30;
  2038.             menuItem -label "Photoshop (ps)";        //    $imgExt[4]  = "ps";      $imgExtNum[4]  = 31;
  2039.             menuItem -label "PNG (png)";               //    $imgExt[5]  = "png";  $imgExtNum[5]  = 32;
  2040.             menuItem -label "QuickDraw (pict)";        //    $imgExt[6]  = "pict"; $imgExtNum[6]  = 33;
  2041.             menuItem -label "Quicktime Movie (qt)";    //    $imgExt[7]  = "qt";   $imgExtNum[7]  = 22;
  2042.             menuItem -label "Quicktime Image (qtif)";//    $imgExt[8]  = "qtif"; $imgExtNum[8]  = 34;
  2043.             menuItem -label "Silicon Graphics (sgi)";//    $imgExt[9] = "sgi";  $imgExtNum[9]  = 5;
  2044.             menuItem -label "Targa (tga)";            //    $imgExt[10] = "tga";  $imgExtNum[10] = 19;
  2045.             menuItem -label "Tiff (tif)";            //    $imgExt[11] = "tif";  $imgExtNum[11] = 3;
  2046.             menuItem -label "Windows Bitmap (bmp)";    //    $imgExt[12] = "bmp";  $imgExtNum[12] = 20;
  2047.         } else {
  2048.             warning "Unsupported platform in renderGlobalsWindow.mel";
  2049.         }
  2050.  
  2051.         }
  2052.  
  2053.         scriptJob -p $parent 
  2054.             -ac "defaultRenderGlobals.imageFormat" 
  2055.             "updateImageFile; updateFileOutputFeedback;";
  2056.  
  2057.         // Renderable Objects ------------------------------------------------
  2058.  
  2059.         //Note: not updating if changed elsewhere
  2060.         optionMenuGrp -label "Renderable Objects" -cc changeRenderObj renderObjMenu;
  2061.             menuItem -label "Render All";
  2062.             menuItem -label "Render Active";
  2063.  
  2064.         // Cameras ------------------------------------------------
  2065.  
  2066.         //Note: not updating if changed elsewhere
  2067.         optionMenuGrp -label "Camera" -cc switchCamera cameraMenu;
  2068.  
  2069.         // Channels ------------------------------------------------
  2070.  
  2071.         //Note: none of these are updating if changed elsewhere
  2072.         checkBoxGrp -numberOfCheckBoxes 1
  2073.                 -label "Channels"
  2074.                 -label1 "RGB Channel (Color)"
  2075.                 -cc updateCameraAttrs
  2076.                 rgbChannel;
  2077.  
  2078.         checkBoxGrp -numberOfCheckBoxes 1
  2079.                 -label1 "Alpha Channel (Mask)"
  2080.                 -cc updateCameraAttrs
  2081.                 alphaChannel;
  2082.  
  2083.         checkBoxGrp -numberOfCheckBoxes 1
  2084.                 -label1 "Depth Channel (Z Depth)"
  2085.                 -cc updateCameraAttrs
  2086.                 depthChannel;
  2087.  
  2088.     setParent ..;
  2089.     setUITemplate -popTemplate;
  2090. }
  2091.  
  2092. global proc createExtensionOptions (string $parent) 
  2093. //
  2094. //  Procedure Name:
  2095. //      createExtensionOptions
  2096. //
  2097. //  Description:
  2098. //      Creates the UI in the "Modify Extension" expand/collapse section.
  2099. //
  2100. {
  2101.     setUITemplate -pushTemplate attributeEditorTemplate;
  2102.  
  2103.     setParent $parent;
  2104.  
  2105.     // If the UI is created already then just update the attribute values.
  2106.     if (`columnLayout -exists rgExtOptionsLayout`) {
  2107.         updateExtOptions;
  2108.         return;
  2109.     }
  2110.  
  2111.     columnLayout -adjustableColumn true rgExtOptionsLayout;
  2112.  
  2113.         checkBoxGrp -numberOfCheckBoxes 1
  2114.             -label ""
  2115.             -label1 "Use Custom Extension:" 
  2116.             -cc changeCustomExtensionCheck
  2117.             imageCheckBox;
  2118.         scriptJob -p $parent 
  2119.             -ac "defaultRenderGlobals.outFormatControl" 
  2120.             "updateExtOptions; updateFileOutputFeedback;";
  2121.         
  2122.         textFieldGrp -label ""
  2123.             -text `getAttr "defaultRenderGlobals.outFormatExt"` 
  2124.             -cc changeCustomExtensionName 
  2125.             userExt;
  2126.         scriptJob -p $parent 
  2127.             -ac "defaultRenderGlobals.outFormatExt" 
  2128.             "updateExtOptions; updateFileOutputFeedback;";
  2129.  
  2130.     setParent ..;
  2131.  
  2132.     // Make sure the values are right
  2133.     updateExtOptions;
  2134.     setUITemplate -popTemplate;
  2135. }
  2136.  
  2137. global proc createFrameOptions (string $parent) 
  2138. //
  2139. //  Procedure Name:
  2140. //      createFrameOptions
  2141. //
  2142. //  Description:
  2143. //      Creates the UI in the "Renumber Frames" expand/collapse section.
  2144. //
  2145. {
  2146.     setUITemplate -pushTemplate attributeEditorTemplate;
  2147.  
  2148.     setParent $parent;
  2149.  
  2150.     // If the UI is created already then just update the attribute values.
  2151.     if (`columnLayout -exists rgFrameLayout`) {
  2152.         updateFrames;
  2153.         return;
  2154.     }
  2155.  
  2156.     columnLayout -adjustableColumn true rgFrameLayout;
  2157.  
  2158.         checkBoxGrp -numberOfCheckBoxes 1
  2159.             -label ""
  2160.             -label1 "Renumber Frames Using:"
  2161.             -cc "setAttr defaultRenderGlobals.modifyExtension #1; updateFrames; updateFileOutputFeedback"
  2162.             frameCheckBox;
  2163.         scriptJob -p $parent 
  2164.             -ac "defaultRenderGlobals.modifyExtension" 
  2165.             "updateFrames; updateFileOutputFeedback;";
  2166.         
  2167.         intFieldGrp -label "Start Number"
  2168.             -cc changeFrameExtension
  2169.             frameStartOverride;
  2170.         scriptJob -p $parent 
  2171.             -ac "defaultRenderGlobals.startExtension" 
  2172.             "updateFrames; updateFileOutputFeedback;";
  2173.  
  2174.         intFieldGrp -label "By Frame"
  2175.             -cc changeFrameExtension
  2176.             frameByOverride;
  2177.         scriptJob -p $parent 
  2178.             -ac "defaultRenderGlobals.byExtension" 
  2179.             "updateFrames; updateFileOutputFeedback;";
  2180.  
  2181.     setParent ..;
  2182.  
  2183.     // Make sure the values are right
  2184.     updateFrames;
  2185.     setUITemplate -popTemplate;
  2186. }
  2187.  
  2188. global proc createFieldOptions (string $parent) 
  2189. //
  2190. //  Procedure Name:
  2191. //      createFieldOptions
  2192. //
  2193. //  Description:
  2194. //      Creates the UI in the "Field Options" expand/collapse section.
  2195. //
  2196. {
  2197.     setUITemplate -pushTemplate attributeEditorTemplate;
  2198.  
  2199.     setParent $parent;
  2200.     string $cName;
  2201.  
  2202.     // If the UI is created already then just update the attribute values.
  2203.     if (`columnLayout -exists rgFieldLayout`) {
  2204.         updateFieldOptions;
  2205.         return;
  2206.     }
  2207.  
  2208.     columnLayout -adjustableColumn true rgFieldLayout;
  2209.  
  2210.         optionMenuGrp -label "Render" -cc changeFieldOptions fieldMenu;
  2211.             menuItem -label "Frames";
  2212.             menuItem -label "Both Fields, Interlaced";
  2213.             menuItem -label "Both Fields, Separate";
  2214.             menuItem -label "Odd Fields";
  2215.             menuItem -label "Even Fields";
  2216.         scriptJob -p $parent 
  2217.             -ac "defaultResolution.fields" 
  2218.             "updateFieldOptions; updateFileOutputFeedback;";
  2219.         
  2220.         optionMenuGrp -label "Field Dominance" 
  2221.             -cc "changeFieldOptions" fieldDominanceMenu;
  2222.         menuItem -label "Odd Field (NTSC)" rgOddField;
  2223.         menuItem -label "Even Field (PAL)" rgEvenField;
  2224.  
  2225.         radioButtonGrp -numberOfRadioButtons 2
  2226.             -label "Zeroth Scanline"
  2227.             -label1 "At Top" 
  2228.             -label2 "At Bottom" 
  2229.             -on1 "setAttr defaultResolution.zerothScanline 0"
  2230.             -on2 "setAttr defaultResolution.zerothScanline 1"
  2231.             scanlineButtons;
  2232.         scriptJob -p $parent 
  2233.             -ac "defaultResolution.zerothScanline" 
  2234.             "updateFieldOptions";
  2235.         
  2236.         separator;
  2237.  
  2238.         radioButtonGrp -numberOfRadioButtons 1
  2239.             -label ""
  2240.             -label1 "No Field Extension" 
  2241.             -onc changeFieldOptions
  2242.             fieldButton1;
  2243.  
  2244.         radioButtonGrp -numberOfRadioButtons 1  
  2245.             -shareCollection fieldButton1
  2246.             -label1 "Default Field Extension (o and e)" 
  2247.             -onc changeFieldOptions
  2248.             fieldButton2;
  2249.  
  2250.         radioButtonGrp -numberOfRadioButtons 1  
  2251.             -shareCollection fieldButton1
  2252.             -label1 "Custom Extension:" 
  2253.             -onc changeFieldOptions
  2254.             fieldButton3;
  2255.  
  2256.         // This works on the above 3 radio buttons
  2257.         scriptJob -p $parent 
  2258.             -ac "defaultRenderGlobals.fieldExtControl" 
  2259.             "updateFieldOptions; updateFileOutputFeedback;";
  2260.  
  2261.         // Make these fields small to indicate that
  2262.         // only a single character is accepted.
  2263.         // There's a SUG on this. #87405
  2264.         //
  2265.            textFieldGrp -label "Odd Field" 
  2266.             -cw 2 30 
  2267.             -cc changeFieldOptions oddFieldExt;
  2268.         scriptJob -p $parent 
  2269.             -ac "defaultRenderGlobals.oddFieldExt" 
  2270.             "updateFieldOptions; updateFileOutputFeedback;";
  2271.  
  2272.            textFieldGrp -label "Even Field" 
  2273.             -cw 2 30 
  2274.             -cc changeFieldOptions evenFieldExt;
  2275.         scriptJob -p $parent 
  2276.             -ac "defaultRenderGlobals.evenFieldExt" 
  2277.             "updateFieldOptions; updateFileOutputFeedback;";
  2278.  
  2279.     setParent ..;
  2280.     setUITemplate -popTemplate;
  2281.  
  2282.     // Make sure the values are right
  2283.     updateFieldOptions;
  2284. }
  2285.  
  2286. global proc createResolution (string $parent) 
  2287. //
  2288. //  Procedure Name:
  2289. //      createResolution
  2290. //
  2291. //  Description:
  2292. //      Creates the UI in the "Resolution" expand/collapse section.
  2293. //
  2294. {
  2295.     //
  2296.     // Make sure the list of predefined resolutions has been read in.
  2297.     //
  2298.     global string   $gImageFormatData[];
  2299.     global string   $gUserImageFormatData[];
  2300.  
  2301.     if (size($gImageFormatData) == 0) {
  2302.         eval("source imageFormats");
  2303.     }
  2304.  
  2305.     int $isMayaEvalVersion = `about -ev`;
  2306.     global string   $gPLEImageFormatData[];
  2307.     if ( $isMayaEvalVersion ) {
  2308.         $gImageFormatData = $gPLEImageFormatData;
  2309.     }
  2310.  
  2311.     if (exists("userImageFormats.mel") && size($gUserImageFormatData) == 0) {
  2312.         // Yes, we need the eval here, to avoid doing the source
  2313.         // until we know whether the file actually exists
  2314.         eval("source userImageFormats");
  2315.     }
  2316.  
  2317.     setUITemplate -pushTemplate attributeEditorTemplate;
  2318.  
  2319.     setParent $parent;
  2320.     string $cName;
  2321.  
  2322.     // If the UI is created already then just update the attribute values.
  2323.     if (`columnLayout -exists rgResolutionLayout`) {
  2324.         updateResolution;
  2325.         return;
  2326.     }
  2327.  
  2328.     global string   $gImageFormatData[];
  2329.     global string   $gUserImageFormatData[];
  2330.     columnLayout -adjustableColumn true rgResolutionLayout;
  2331.         int        $resItem;
  2332.         int        $numResolutionPresets = size($gImageFormatData);
  2333.         int        $numUserResolutionPresets = size($gUserImageFormatData);
  2334.         string  $allResNodes[] = `ls -type resolution`;
  2335.         int        $numResolutionNodePresets = size($allResNodes) - 1;
  2336.         int        $numTokens;
  2337.         string    $tokens[];
  2338.         string  $niceName;
  2339.  
  2340.         optionMenuGrp -label "Presets" 
  2341.             -cc "changeResolution" resolutionMenu;
  2342.         menuItem -label "Custom";
  2343.         for ($resItem = 0; $resItem < $numResolutionPresets; $resItem++) {
  2344.             string $item = $gImageFormatData[$resItem];
  2345.             $numTokens = tokenize($item, $tokens);
  2346.             //
  2347.             // Change any underscore into a space;
  2348.             // some names may have up to 2 underscores in them,
  2349.             // so we do this twice.
  2350.             $niceName = `substitute "_" $tokens[0] " "`;
  2351.             $niceName = `substitute "_" $niceName " "`;
  2352.             menuItem -label $niceName;
  2353.         }
  2354.         for ($resItem = 0; $resItem < $numUserResolutionPresets; $resItem++) {
  2355.             string $item = $gUserImageFormatData[$resItem];
  2356.             $numTokens = tokenize($item, $tokens);
  2357.             //
  2358.             // Change any underscore into a space;
  2359.             // some names may have up to 2 underscores in them,
  2360.             // so we do this twice.
  2361.             $niceName = `substitute "_" $tokens[0] " "`;
  2362.             $niceName = `substitute "_" $niceName " "`;
  2363.             menuItem -label $niceName;
  2364.         }
  2365.         for ($resItem = 0; $resItem < $numResolutionNodePresets; $resItem++) {
  2366.             menuItem -label $allResNodes[$resItem + 1];
  2367.         }
  2368.  
  2369.         separator;
  2370.         
  2371.         checkBoxGrp -numberOfCheckBoxes 1
  2372.             -label1 "Maintain Width/Height Ratio"
  2373.             -cc "setAttr defaultResolution.aspectLock #1;checkAspectLock \"defaultResolution\";updateResolution"
  2374.             aspectLockCheck;
  2375.  
  2376.         intFieldGrp -label "Width" 
  2377.             -cc "changeAspectLockWidth"
  2378.             resWidth;
  2379.         intFieldGrp -label "Height" 
  2380.             -cc changeAspectLockHeight
  2381.             resHeight;
  2382.         
  2383.         separator;
  2384.  
  2385.         checkBoxGrp -numberOfCheckBoxes 1
  2386.             -label1 "Lock Device Aspect Ratio" 
  2387.             -cc "setAttr defaultResolution.lockDeviceAspectRatio #1; changeAspectLockWidth"
  2388.             ratioLockCheck;
  2389.  
  2390.         floatFieldGrp -label "Device Aspect Ratio"  
  2391.             -cc "updateDeviceAspectRatio" resRatio;
  2392.  
  2393.         floatFieldGrp -label "Pixel Aspect Ratio"  
  2394.             -cc "rgAdjustDeviceAspect \"defaultResolution\"" pixRatio;
  2395.  
  2396.     setParent ..;
  2397.     setUITemplate -popTemplate;
  2398.  
  2399.     // Make sure the values are right
  2400.     updateResolution;
  2401. }
  2402.  
  2403. global proc createRayTraceQuality (string $parent) 
  2404. //
  2405. //  Procedure Name:
  2406. //      createRayTraceQuality
  2407. //
  2408. //  Description:
  2409. //      Creates the UI in the "Raytracing Quality" 
  2410. //        expand/collapse section.
  2411. //
  2412. {
  2413.     setUITemplate -pushTemplate attributeEditorTemplate;
  2414.  
  2415.     setParent $parent;
  2416.     string $cName;
  2417.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  2418.  
  2419.     // If the UI is created already then reset the command with the correct
  2420.     // render quality + update the attribute values.
  2421.     if (`columnLayout -exists rgRaytraceLayout`) {
  2422.         checkBoxGrp -e 
  2423.             -cc ("setAttr " + $rendQual[0] + ".enableRaytracing #1;updateRaytraceQuality")
  2424.             raytraceCheck;
  2425.         intSliderGrp -e 
  2426.             -cc ("setAttr " + $rendQual[0] + ".reflections #1")
  2427.             reflectionsField;
  2428.         intSliderGrp -e
  2429.             -cc ("setAttr " + $rendQual[0] + ".refractions #1")
  2430.             refractionsField;
  2431.         intSliderGrp -e
  2432.             -cc ("setAttr " + $rendQual[0] + ".shadows #1")
  2433.             shadowsField;
  2434.         floatSliderGrp -e
  2435.             -cc ("setAttr " + $rendQual[0] + ".rayTraceBias #1")
  2436.             rayTraceBiasField;
  2437.  
  2438.         updateRaytraceQuality;
  2439.         return;
  2440.     }
  2441.  
  2442.     columnLayout -adjustableColumn true rgRaytraceLayout;
  2443.         
  2444.         checkBoxGrp -numberOfCheckBoxes 1
  2445.             -label1 "Raytracing"
  2446.             -cc ("setAttr " + $rendQual[0] + ".enableRaytracing #1;updateRaytraceQuality")
  2447.             raytraceCheck;
  2448.  
  2449.         intSliderGrp -label "Reflections"
  2450.             -cc ("setAttr " + $rendQual[0] + ".reflections #1")
  2451.             -min 0 -max 20 reflectionsField;
  2452.  
  2453.         intSliderGrp -label "Refractions"
  2454.             -cc ("setAttr " + $rendQual[0] + ".refractions #1")
  2455.             -min 0 -max 20 refractionsField;
  2456.  
  2457.         intSliderGrp -label "Shadows"
  2458.             -cc ("setAttr " + $rendQual[0] + ".shadows #1")
  2459.             -min 0 -max 20 shadowsField;
  2460.  
  2461.         floatSliderGrp -label "Bias"
  2462.             -cc ("setAttr " + $rendQual[0] + ".rayTraceBias #1")
  2463.             -min 0.0 -max 1.0 rayTraceBiasField;
  2464.  
  2465.     setParent ..;
  2466.     setUITemplate -popTemplate;
  2467.  
  2468.     // Make sure the values are right
  2469.     updateRaytraceQuality;
  2470. }
  2471.  
  2472. global proc createRenderQuality (string $parent) 
  2473. //
  2474. //  Procedure Name:
  2475. //      createRenderQuality
  2476. //
  2477. //  Description:
  2478. //      Creates the UI in the "Anti-aliasing Quality" 
  2479. //        expand/collapse section.
  2480. //
  2481. {
  2482.     setUITemplate -pushTemplate attributeEditorTemplate;
  2483.  
  2484.     setParent $parent;
  2485.     string $cName;
  2486.  
  2487.     // If the UI is created already then reset the command with the correct
  2488.     // render quality + update the attribute values.
  2489.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  2490.     if (`columnLayout -exists rgQualityLayout`) {
  2491.         intSliderGrp -e
  2492.             -cc ("setAttr " + $rendQual[0] + ".shadingSamples #1;updateRenderQuality")
  2493.             shadingSamplesField;
  2494.         intSliderGrp -e 
  2495.             -cc ("setAttr " + $rendQual[0] + ".maxShadingSamples #1;updateRenderQuality")
  2496.             maxShadingSamplesField;
  2497.         intSliderGrp -e
  2498.             -cc ("setAttr " + $rendQual[0] + ".visibilitySamples #1;updateRenderQuality")
  2499.             visSamplesField;
  2500.         intSliderGrp -e
  2501.             -cc ("setAttr " + $rendQual[0] + ".maxVisibilitySamples #1;updateRenderQuality")
  2502.             maxVisSamplesField;
  2503.         intSliderGrp -e
  2504.             -cc ("setAttr " + $rendQual[0] + ".particleSamples #1;updateRenderQuality")
  2505.             particlesSamplesField;
  2506.         checkBoxGrp -e
  2507.             -cc ("setAttr " + $rendQual[0] + ".useMultiPixelFilter #1;updateRenderQuality")
  2508.             pixelCheck;
  2509.         floatSliderGrp -e
  2510.             -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthX #1")
  2511.             filterXField;
  2512.         floatSliderGrp -e
  2513.             -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthY #1")
  2514.             filterYField;
  2515.         floatSliderGrp -e
  2516.             -cc ("setAttr " + $rendQual[0] + ".redThreshold #1; updateRenderQuality")
  2517.             contrastRedField;
  2518.         floatSliderGrp -e
  2519.             -cc ("setAttr " + $rendQual[0] + ".greenThreshold #1; updateRenderQuality")
  2520.             contrastGreenField;
  2521.         floatSliderGrp -e
  2522.             -cc ("setAttr " + $rendQual[0] + ".blueThreshold #1; updateRenderQuality")
  2523.             contrastBlueField;
  2524.         floatSliderGrp -e
  2525.             -cc ("setAttr " + $rendQual[0] + ".coverageThreshold #1")
  2526.             contrastCoverField;
  2527.  
  2528.         updateRenderQuality;
  2529.         return;
  2530.     }
  2531.  
  2532.     columnLayout -adjustableColumn true rgQualityLayout;
  2533.  
  2534.         frameLayout 
  2535.             -labelVisible false -borderVisible true 
  2536.             -borderStyle "etchedIn"
  2537.             -collapsable false -collapse true;
  2538.         columnLayout -adjustableColumn true;
  2539.         
  2540.         optionMenuGrp -label "Presets" qualityPresetMenu;
  2541.         optionMenuGrp -edit -cc RGsetDefaultQuality -cw 2 240 qualityPresetMenu;
  2542.             
  2543.             menuItem -label "Custom" rgCustomQuality;
  2544.             menuItem -label "Preview Quality" rgPreviewQuality;
  2545.             menuItem -label "Intermediate Quality" rgIntermediateQuality;
  2546.             menuItem -label "Production Quality" rgProductionQuality;
  2547.             menuItem -label "Contrast Sensitive Production" rgContrastProductionQuality;
  2548.             menuItem -label "3D Motion Blur Production" rgMotionBlurQuality;
  2549.         
  2550.         optionMenuGrp -label "Edge Anti-aliasing" 
  2551.             -cc RGsetEdgeQuality edgeMenu;
  2552.             
  2553.             menuItem -label "Low Quality";
  2554.             menuItem -label "Medium Quality";
  2555.             menuItem -label "High Quality";
  2556.             menuItem -label "Highest Quality";
  2557.                         
  2558.         setParent ..;
  2559.         setParent ..;
  2560.  
  2561.         frameLayout -label "Number of Samples" 
  2562.             -labelVisible true -borderVisible true 
  2563.             -borderStyle "etchedIn"
  2564.             -labelAlign "center" -labelWidth 150
  2565.             -collapsable false -collapse true;
  2566.         columnLayout -adjustableColumn true;
  2567.         
  2568.             intSliderGrp -label "Shading"
  2569.                 -cc ("setAttr " + $rendQual[0] + ".shadingSamples #1;updateRenderQuality")
  2570.                 -min 1 -max 20 shadingSamplesField;
  2571.        
  2572.             intSliderGrp -label "Max Shading"
  2573.                 -cc ("setAttr " + $rendQual[0] + ".maxShadingSamples #1;updateRenderQuality")
  2574.                 -min 1 -max 20 maxShadingSamplesField;
  2575.         
  2576.             intSliderGrp -label "3D Blur Visib."
  2577.                 -cc ("setAttr " + $rendQual[0] + ".visibilitySamples #1;updateRenderQuality")
  2578.                 -min 1 -max 20 visSamplesField;
  2579.         
  2580.             intSliderGrp -label "Max 3D Blur Visib."
  2581.                 -cc ("setAttr " + $rendQual[0] + ".maxVisibilitySamples #1;updateRenderQuality")
  2582.                 -min 1 -max 20 maxVisSamplesField;
  2583.         
  2584.             intSliderGrp -label "Particles"
  2585.                 -cc ("setAttr " + $rendQual[0] + ".particleSamples #1;updateRenderQuality")
  2586.                 -min 1 -max 20 particlesSamplesField;
  2587.                         
  2588.         setParent ..;
  2589.         setParent ..;
  2590.  
  2591.         frameLayout -label "Multipixel Filtering" 
  2592.             -labelVisible true -borderVisible true 
  2593.             -borderStyle "etchedIn"
  2594.             -labelAlign "center" -labelWidth 150
  2595.             -collapsable false -collapse true;
  2596.         columnLayout -adjustableColumn true;
  2597.  
  2598.             checkBoxGrp -numberOfCheckBoxes 1
  2599.                 -label1 "Use Multi Pixel Filter"
  2600.                 -cc ("setAttr " + $rendQual[0] + ".useMultiPixelFilter #1;updateRenderQuality")
  2601.                 pixelCheck;
  2602.  
  2603.             optionMenuGrp -label "Pixel Filter Type" 
  2604.                 -cc "RGsetPixelFilterType" pixelFilterMenu;
  2605.             
  2606.                 menuItem -label "Box Filter";
  2607.                 menuItem -label "Triangle Filter";
  2608.                 menuItem -label "Gaussian Filter";
  2609.                 menuItem -label "Quadratic B-Spline Filter";
  2610.                 menuItem -label "Plug-in Filter";
  2611.         
  2612.             floatSliderGrp -label "Pixel Filter Width X"
  2613.                 -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthX #1")
  2614.                 -min 1.0 -max 3.0 filterXField;
  2615.         
  2616.             floatSliderGrp -label "Pixel Filter Width Y"
  2617.                 -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthY #1")
  2618.                 -min 1.0 -max 3.0 filterYField;
  2619.        
  2620.         setParent ..;
  2621.         setParent ..;
  2622.         
  2623.  
  2624.         frameLayout -label "Contrast Threshold" 
  2625.             -labelVisible true -borderVisible true 
  2626.             -borderStyle "etchedIn"
  2627.             -labelAlign "center" -labelWidth 150
  2628.             -collapsable false -collapse true;
  2629.         columnLayout -adjustableColumn true;
  2630.         
  2631.             floatSliderGrp -label "Red"
  2632.                 -cc ("setAttr " + $rendQual[0] + ".redThreshold #1; updateRenderQuality")
  2633.                 -min 0.0 -max 1.0 contrastRedField;
  2634.         
  2635.             floatSliderGrp -label "Green"
  2636.                 -cc ("setAttr " + $rendQual[0] + ".greenThreshold #1; updateRenderQuality")
  2637.                 -min 0.0 -max 1.0 contrastGreenField;
  2638.         
  2639.             floatSliderGrp -label "Blue"
  2640.                 -cc ("setAttr " + $rendQual[0] + ".blueThreshold #1; updateRenderQuality")
  2641.                 -min 0.0 -max 1.0 contrastBlueField;
  2642.         
  2643.             floatSliderGrp -label "Coverage"
  2644.                 -cc ("setAttr " + $rendQual[0] + ".coverageThreshold #1")
  2645.                 -min 0.0 -max 1.0 contrastCoverField;
  2646.                         
  2647.         setParent ..;
  2648.         setParent ..;
  2649.  
  2650.     setParent ..;
  2651.     setUITemplate -popTemplate;
  2652.  
  2653.     // Make sure the values are right
  2654.     updateRenderQuality;
  2655. }
  2656.  
  2657. global proc RGsetPixelFilterType()
  2658. {
  2659.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  2660.     string $curr = `optionMenuGrp -q -v pixelFilterMenu`;
  2661.     if ($curr == "Box Filter") {
  2662.         setAttr ($rendQual[0] + ".pixelFilterType") 0;
  2663.     } else if ($curr == "Triangle Filter") {
  2664.         setAttr ($rendQual[0] + ".pixelFilterType") 2;
  2665.     } else if ($curr == "Gaussian Filter") {
  2666.         setAttr ($rendQual[0] + ".pixelFilterType") 4;
  2667.     } else if ($curr == "Quadratic B-Spline Filter") {
  2668.         setAttr ($rendQual[0] + ".pixelFilterType") 5;
  2669.     } else if ($curr == "Plug-in Filter") {
  2670.         setAttr ($rendQual[0] + ".pixelFilterType") 1000;
  2671.     }
  2672.     updateRenderQuality;
  2673. }
  2674.  
  2675. global proc RGsetDefaultQuality ()
  2676. {
  2677.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  2678.     string $curr = `optionMenuGrp -q -v qualityPresetMenu`;
  2679.     if ($curr == "Preview Quality") {
  2680.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 3;
  2681.         setAttr ($rendQual[0] + ".useMultiPixelFilter") 0;
  2682.         setAttr ($rendQual[0] + ".shadingSamples") 1;
  2683.         setAttr ($rendQual[0] + ".maxShadingSamples") 1;
  2684.         setAttr ($rendQual[0] + ".visibilitySamples") 1;
  2685.         setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
  2686.         setAttr ($rendQual[0] + ".redThreshold") 0.4;
  2687.         setAttr ($rendQual[0] + ".greenThreshold") 0.3;
  2688.         setAttr ($rendQual[0] + ".blueThreshold") 0.6;
  2689.         setAttr ($rendQual[0] + ".reflections") 1;
  2690.         setAttr ($rendQual[0] + ".refractions") 6;
  2691.         setAttr ($rendQual[0] + ".shadows") 2;
  2692.     } else if ($curr == "Intermediate Quality") {
  2693.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
  2694.         setAttr ($rendQual[0] + ".useMultiPixelFilter") 0;
  2695.         setAttr ($rendQual[0] + ".shadingSamples") 1;
  2696.         setAttr ($rendQual[0] + ".maxShadingSamples") 8;
  2697.         setAttr ($rendQual[0] + ".visibilitySamples") 1;
  2698.         setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
  2699.         setAttr ($rendQual[0] + ".redThreshold") 0.4;
  2700.         setAttr ($rendQual[0] + ".greenThreshold") 0.3;
  2701.         setAttr ($rendQual[0] + ".blueThreshold") 0.6;
  2702.         setAttr ($rendQual[0] + ".reflections") 1;
  2703.         setAttr ($rendQual[0] + ".refractions") 6;
  2704.         setAttr ($rendQual[0] + ".shadows") 2;
  2705.     } else if ($curr == "Production Quality") {
  2706.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
  2707.         setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
  2708.         setAttr ($rendQual[0] + ".shadingSamples") 2;
  2709.         setAttr ($rendQual[0] + ".maxShadingSamples") 8;
  2710.         setAttr ($rendQual[0] + ".visibilitySamples") 1;
  2711.         setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
  2712.         setAttr ($rendQual[0] + ".redThreshold") 0.4;
  2713.         setAttr ($rendQual[0] + ".greenThreshold") 0.3;
  2714.         setAttr ($rendQual[0] + ".blueThreshold") 0.6;
  2715.         setAttr ($rendQual[0] + ".reflections") 10;
  2716.         setAttr ($rendQual[0] + ".refractions") 10;
  2717.         setAttr ($rendQual[0] + ".shadows") 10;
  2718.     } else if ($curr == "Contrast Sensitive Production") {
  2719.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
  2720.         setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
  2721.         setAttr ($rendQual[0] + ".shadingSamples") 2;
  2722.         setAttr ($rendQual[0] + ".maxShadingSamples") 8;
  2723.         setAttr ($rendQual[0] + ".visibilitySamples") 1;
  2724.         setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
  2725.         setAttr ($rendQual[0] + ".redThreshold") 0.2;
  2726.         setAttr ($rendQual[0] + ".greenThreshold") 0.15;
  2727.         setAttr ($rendQual[0] + ".blueThreshold") 0.3;
  2728.         setAttr ($rendQual[0] + ".reflections") 10;
  2729.         setAttr ($rendQual[0] + ".refractions") 10;
  2730.         setAttr ($rendQual[0] + ".shadows") 10;
  2731.     } else if ($curr == "3D Motion Blur Production") {
  2732.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
  2733.         setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
  2734.         setAttr ($rendQual[0] + ".shadingSamples") 3;
  2735.         setAttr ($rendQual[0] + ".maxShadingSamples") 8;
  2736.         setAttr ($rendQual[0] + ".visibilitySamples") 1;
  2737.         setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
  2738.         setAttr ($rendQual[0] + ".redThreshold") 0.4;
  2739.         setAttr ($rendQual[0] + ".greenThreshold") 0.3;
  2740.         setAttr ($rendQual[0] + ".blueThreshold") 0.6;
  2741.         setAttr ($rendQual[0] + ".reflections") 10;
  2742.         setAttr ($rendQual[0] + ".refractions") 10;
  2743.         setAttr ($rendQual[0] + ".shadows") 10;
  2744.     }
  2745.     updateRenderQuality;
  2746.  
  2747.     if (`columnLayout -exists rgRaytraceLayout`) updateRaytraceQuality;
  2748. }
  2749.  
  2750. global proc RGsetEdgeQuality()
  2751. {
  2752.     string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  2753.     string $curr = `optionMenuGrp -q -v edgeMenu`;
  2754.     if ($curr == "Low Quality") {
  2755.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 3;
  2756.     } else if ($curr == "Medium Quality") {
  2757.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 2;
  2758.     } else if ($curr == "High Quality") {
  2759.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 1;
  2760.     } else {
  2761.         setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
  2762.     }
  2763.  
  2764.     updateRenderQuality;
  2765. }
  2766.  
  2767. global proc createRenderOptions (string $parent) 
  2768. //
  2769. //  Procedure Name:
  2770. //      createRenderOptions
  2771. //
  2772. //  Description:
  2773. //      Creates the UI in the "Render Options" expand/collapse section.
  2774. //
  2775. {
  2776.     setUITemplate -pushTemplate attributeEditorTemplate;
  2777.  
  2778.     setParent $parent;
  2779.     string $cName;
  2780.  
  2781.     // If the UI is created already then just update the attribute values.
  2782.     if (`columnLayout -exists rgOptionsLayout`) {
  2783.         updateRenderOptions;
  2784.         return;
  2785.     }
  2786.  
  2787.     columnLayout -adjustableColumn true rgOptionsLayout;
  2788.  
  2789.            textFieldGrp -label "Plug-in Format" 
  2790.             -cc "setAttr defaultRenderGlobals.pluginFormat -type \"string\" \"#1\""
  2791.             plugInFormat;
  2792.         
  2793.            textFieldGrp -label "Pre Render MEL" 
  2794.             -cc "setAttr defaultRenderGlobals.preRenderMel -type \"string\" \"#1\""
  2795.             preRenderMel;
  2796.         
  2797.            textFieldGrp -label "Post Render MEL" 
  2798.             -cc "setAttr defaultRenderGlobals.postRenderMel -type \"string\" \"#1\""
  2799.             postRenderMel;
  2800.     
  2801.         separator;
  2802.         attrNavigationControlGrp -l "Environment Fog"
  2803.                 -at defaultRenderGlobals.fogGeometry envFogControl;
  2804.         if (`isTrue MayaCreatorExists`) {
  2805.             checkBoxGrp -numberOfCheckBoxes 1
  2806.                 -label1 "Apply Fog in Post" 
  2807.                 -cc "setAttr defaultRenderGlobals.applyFogInPost #1;intFieldGrp -edit -enable #1 postFogBlurField;"
  2808.                 applyFogInPostCheck;
  2809.             intFieldGrp -label "Post Fog Blur"
  2810.                 -cc "setAttr defaultRenderGlobals.postFogBlur #1"
  2811.                 -enable `getAttr defaultRenderGlobals.applyFogInPost`
  2812.                 postFogBlurField;
  2813.             separator;
  2814.         }
  2815.  
  2816.         checkBoxGrp -numberOfCheckBoxes 1
  2817.             -label1 "Shadows Obey Light Linking" 
  2818.             -cc "setAttr defaultRenderGlobals.shadowsObeyLightLinking #1;"
  2819.             shadowLightLinkCheck;
  2820.         
  2821.         checkBoxGrp -numberOfCheckBoxes 1
  2822.             -label1 "Enable Depth Maps"
  2823.             -cc "setAttr defaultRenderGlobals.enableDepthMaps #1"
  2824.             depthMapCheck;
  2825.  
  2826.         checkBoxGrp -numberOfCheckBoxes 1
  2827.             -label1 "Enable Default Light"
  2828.             -cc "setAttr defaultRenderGlobals.enableDefaultLight #1"
  2829.             defaultLightCheck;
  2830.  
  2831.         checkBoxGrp -numberOfCheckBoxes 1
  2832.             -label1 "Ignore Film Gate"
  2833.             -cc "setAttr defaultRenderGlobals.ignoreFilmGate #1"
  2834.             filmGateCheck;
  2835.  
  2836.         checkBoxGrp -numberOfCheckBoxes 1
  2837.             -label1 "Clip Final Shaded Color"
  2838.             -cc "setAttr defaultRenderGlobals.clipFinalShadedColor #1"
  2839.             clipCheck;
  2840.  
  2841.         checkBoxGrp -numberOfCheckBoxes 1
  2842.             -label1 "Jitter Final Color"
  2843.             -cc "setAttr defaultRenderGlobals.jitterFinalColor #1"
  2844.             jitterColor;
  2845.         
  2846.         floatFieldGrp -label "Gamma Correction"
  2847.             -cc "setAttr defaultRenderGlobals.gammaCorrection #1"
  2848.             gammaField;
  2849.     
  2850.         separator;
  2851.         
  2852.         checkBoxGrp -numberOfCheckBoxes 1
  2853.             -label1 "Composite" 
  2854.             -cc "setAttr defaultRenderGlobals.composite #1;floatFieldGrp -edit -enable #1 compValueField;"
  2855.             compCheck;
  2856.         
  2857.         floatFieldGrp -label "Composite Threshold"
  2858.             -cc "setAttr defaultRenderGlobals.compositeThreshold #1"
  2859.             compValueField;
  2860.  
  2861.     setParent ..;
  2862.     setUITemplate -popTemplate;
  2863.  
  2864.     // Make sure the values are right
  2865.     updateRenderOptions;
  2866. }
  2867.  
  2868.  
  2869. global proc updateNumCpusSlider(int $value)
  2870. //
  2871. //  Procedure Name:
  2872. //      updateNumCpusSlider
  2873. //
  2874. //  Description:
  2875. //      When the controls for the number of CPUs are updated this
  2876. //      procedure will be invoked. The check box, field and slider
  2877. //      will be update to reflect the new value. If the value is
  2878. //      zero, all CPUs will be used.
  2879. //
  2880. {
  2881.     if ( `about -evalVersion` ) {
  2882.         warning( "Maya Personal Learning Edition limits rendering to a single CPU");
  2883.         checkBoxGrp -e -enable false -value1 false numCpusCheckBox;
  2884.         intSliderGrp -e -enable false -value 1 numCpusSlider;
  2885.         return;
  2886.     }
  2887.  
  2888.     if ($value == 0) {
  2889.         checkBoxGrp -e -value1 true numCpusCheckBox;
  2890.  
  2891.         intSliderGrp -e -enable false -value $value numCpusSlider;
  2892.     }
  2893.     else {
  2894.         checkBoxGrp -e -value1 false numCpusCheckBox;
  2895.  
  2896.         intSliderGrp -e -enable true -value $value numCpusSlider;
  2897.  
  2898.         if (`iprEngine -query -exists defaultIprEngine`) {
  2899.             warning -showLineNumber false
  2900.                 ("IPR will need to be closed before this change in CPUs will"+
  2901.                 " take effect.");
  2902.         }
  2903.     }
  2904.  
  2905.     setAttr defaultRenderGlobals.numCpusToUse $value;
  2906. }
  2907.  
  2908. global proc updatePerformanceOptions ()
  2909. //
  2910. //  Procedure Name:
  2911. //      updatePerformanceOptions
  2912. //
  2913. //  Description:
  2914. //      Gets the real values from the nodes and sets the UI based
  2915. //        on these values.  This procedure updates all of the memory
  2916. //        and performance values.
  2917. //
  2918.     checkBoxGrp -edit
  2919.         -v1 `getAttr defaultRenderGlobals.useFileCache`
  2920.         cacheCheck;
  2921.     
  2922.     checkBoxGrp -edit
  2923.         -v1 `getAttr defaultRenderGlobals.optimizeInstances`
  2924.         optCheck;
  2925.     
  2926.     checkBoxGrp -edit
  2927.         -v1 `getAttr defaultRenderGlobals.reuseTessellations`
  2928.         reuseCheck;
  2929.  
  2930.     checkBoxGrp -edit
  2931.         -v1 `getAttr defaultRenderGlobals.useDisplacementBoundingBox`
  2932.         dispBBCheck;
  2933.  
  2934.     intSliderGrp -edit
  2935.         -v `getAttr defaultRenderGlobals.recursionDepth`
  2936.         recursionDepth;
  2937.  
  2938.     intSliderGrp -edit
  2939.         -v `getAttr defaultRenderGlobals.leafPrimitives`
  2940.         leafPrim;
  2941.  
  2942.     floatSliderGrp -edit
  2943.         -v `getAttr defaultRenderGlobals.subdivisionPower`
  2944.         subPower;
  2945.  
  2946. //    intSliderGrp -edit
  2947. //        -v `getAttr defaultRenderGlobals.subdivisionHashSize`
  2948. //        subHash;
  2949.  
  2950.     updateNumCpusSlider(`getAttr defaultRenderGlobals.numCpusToUse`);
  2951. }
  2952.  
  2953.  
  2954. global proc createPerformanceOptions (string $parent) 
  2955. //
  2956. //  Procedure Name:
  2957. //      createPerformanceOptions
  2958. //
  2959. //  Description:
  2960. //      Creates the UI in the "Memory and Performance Options" 
  2961. //        expand/collapse section.
  2962. //
  2963. {
  2964.     setUITemplate -pushTemplate attributeEditorTemplate;
  2965.  
  2966.     setParent $parent;
  2967.     string $cName;
  2968.  
  2969.     // If the UI is created already then just update the attribute values.
  2970.     if (`columnLayout -exists rgPerformanceLayout`) {
  2971.         updatePerformanceOptions;
  2972.         return;
  2973.     }
  2974.  
  2975.     columnLayout -adjustableColumn true rgPerformanceLayout;
  2976.  
  2977.         frameLayout -label "Tessellation" 
  2978.             -labelVisible true -borderVisible true 
  2979.             -borderStyle "etchedIn"
  2980.             -labelAlign "center" -labelWidth 100
  2981.             -collapsable false -collapse true;
  2982.         columnLayout -adjustableColumn true;
  2983.     
  2984.             checkBoxGrp -numberOfCheckBoxes 1
  2985.                 -label1 "Use File Cache" 
  2986.                 -cc "setAttr defaultRenderGlobals.useFileCache #1;"
  2987.                 cacheCheck;
  2988.         
  2989.             checkBoxGrp -numberOfCheckBoxes 1
  2990.                 -label1 "Optimize Instances" 
  2991.                 -cc "setAttr defaultRenderGlobals.optimizeInstances #1;"
  2992.                 optCheck;
  2993.     
  2994.             checkBoxGrp -numberOfCheckBoxes 1
  2995.                 -label1 "Reuse Tessellations" 
  2996.                 -cc "setAttr defaultRenderGlobals.reuseTessellations #1;"
  2997.                 reuseCheck;
  2998.  
  2999.             checkBoxGrp -numberOfCheckBoxes 1
  3000.                 -label1 "Use Displacement Bounding Box" 
  3001.                 -cc "setAttr defaultRenderGlobals.useDisplacementBoundingBox #1;"
  3002.                 dispBBCheck;
  3003.  
  3004.         setParent ..;
  3005.         setParent ..;
  3006.  
  3007.         frameLayout -label "Ray Tracing" 
  3008.             -labelVisible true -borderVisible true 
  3009.             -borderStyle "etchedIn"
  3010.             -labelAlign "center"  -labelWidth 100
  3011.             -collapsable false -collapse true;
  3012.         columnLayout -adjustableColumn true;
  3013.     
  3014.             intSliderGrp -label "Recursion Depth"
  3015.                 -min 1 -max 5
  3016.                 -cc "setAttr defaultRenderGlobals.recursionDepth `intSliderGrp -q -v recursionDepth`"
  3017.                 recursionDepth;
  3018.  
  3019.             intSliderGrp -label "Leaf Primitives"
  3020.                 -min 20 -max 200
  3021.                 -cc "setAttr defaultRenderGlobals.leafPrimitives `intSliderGrp -q -v leafPrim`"
  3022.                 leafPrim;
  3023.  
  3024.             floatSliderGrp -label "Subdivision Power"
  3025.                 -min 0.01 -max 1.0
  3026.                 -cc "setAttr defaultRenderGlobals.subdivisionPower `floatSliderGrp -q -v subPower`"
  3027.                 subPower;
  3028.  
  3029. //            intSliderGrp -label "Subdiv Hash Size"
  3030. //                -min 1 -max 100
  3031. //                -cc "setAttr defaultRenderGlobals.subdivisionHashSize `intSliderGrp -q -v subHash`"
  3032. //                subHash;
  3033.  
  3034.         setParent ..;
  3035.         setParent ..;
  3036.  
  3037.         frameLayout -label "Multi Processing" 
  3038.             -labelVisible true -borderVisible true 
  3039.             -borderStyle "etchedIn"
  3040.             -labelAlign "center"  -labelWidth 100
  3041.             -collapsable false -collapse true;
  3042.         columnLayout -adjustableColumn true;
  3043.         
  3044.             checkBoxGrp -numberOfCheckBoxes 1
  3045.                 -label1 "Use All Available CPUs"
  3046.                 -cc "updateNumCpusSlider(#1 ? 0 : 1)"
  3047.                 numCpusCheckBox;
  3048.  
  3049.             intSliderGrp
  3050.                 -label "Num. CPUs to Use"
  3051.                 -cc "updateNumCpusSlider(#1)"
  3052.                 -minValue 1 -maxValue 8
  3053.                 -fieldMinValue 0 -fieldMaxValue 256
  3054.                 numCpusSlider;
  3055.  
  3056.         setParent ..;
  3057.         setParent ..;
  3058.  
  3059.     setParent ..;
  3060.     setUITemplate -popTemplate;
  3061.  
  3062.     // Make sure the values are right
  3063.     updatePerformanceOptions;
  3064. }
  3065.  
  3066.  
  3067. global proc updateIPROptions ()
  3068. //
  3069. //  Procedure Name:
  3070. //      updateIPROptions
  3071. //
  3072. //  Description:
  3073. //      Gets the real values from the option vars and sets the UI based
  3074. //        on these values.  This procedure updates all of the IPR
  3075. //        values.
  3076. //
  3077.     int $doShading = `optionVar -query iprRenderShading`;
  3078.     checkBoxGrp -edit -v1 $doShading iprShadingCheck;
  3079.     checkBoxGrp -edit -v1 `optionVar -query iprRenderShadowMaps` 
  3080.         -enable $doShading iprShadowCheck;
  3081.     checkBoxGrp -edit -v1 `optionVar -query iprRenderMotionBlur` ipr2DBlurCheck;
  3082. }
  3083.  
  3084. global proc updateIPRShadingOptionVar()
  3085. {
  3086.     int $doShading = `checkBoxGrp -q -v1 iprShadingCheck`;
  3087.     optionVar -intValue iprRenderShading $doShading;
  3088.     checkBoxGrp -edit -enable $doShading iprShadowCheck;
  3089. }
  3090.  
  3091. global proc updateIPRShadowOptionVar()
  3092. {
  3093.     int $doShadows = `checkBoxGrp -q -v1 iprShadowCheck`;
  3094.     optionVar -intValue iprRenderShadowMaps $doShadows;
  3095. }
  3096.  
  3097. global proc updateIPR2dBlurOptionVar()
  3098. {
  3099.     int $doBlur = `checkBoxGrp -q -v1 ipr2DBlurCheck`;
  3100.     optionVar -intValue iprRenderMotionBlur $doBlur;
  3101. }
  3102.  
  3103. global proc createIPROptions (string $parent) 
  3104. //
  3105. //  Procedure Name:
  3106. //      createIPROptions
  3107. //
  3108. //  Description:
  3109. //      Creates the UI in the "IPR Render Globals" 
  3110. //        expand/collapse section.
  3111. //
  3112. {
  3113.     setUITemplate -pushTemplate attributeEditorTemplate;
  3114.  
  3115.     setParent $parent;
  3116.     string $cName;
  3117.  
  3118.     // If the UI is created already then just update the attribute values.
  3119.     if (`columnLayout -exists rgIPRLayout`) {
  3120.         updateIPROptions;
  3121.         return;
  3122.     }
  3123.  
  3124.     columnLayout -adjustableColumn true rgIPRLayout;
  3125.         checkBoxGrp -numberOfCheckBoxes 1
  3126.             -label1 "Render Shading, Lighting and Glow" 
  3127.             -cc "updateIPRShadingOptionVar"
  3128.             iprShadingCheck;
  3129.  
  3130.         checkBoxGrp -numberOfCheckBoxes 1
  3131.             -label1 "Render Shadow Maps" 
  3132.             -cc "updateIPRShadowOptionVar"
  3133.             iprShadowCheck;
  3134.  
  3135.         checkBoxGrp -numberOfCheckBoxes 1
  3136.             -label1 "Render 2D Motion Blur" 
  3137.             -cc "updateIPR2dBlurOptionVar"
  3138.             ipr2DBlurCheck;
  3139.  
  3140.     setParent ..;
  3141.     setUITemplate -popTemplate;
  3142.  
  3143.     // Make sure the values are right
  3144.     updateIPROptions;
  3145. }
  3146.  
  3147. global proc updateUrchinOptions ()
  3148. //
  3149. //  Procedure Name:
  3150. //      updateUrchinOptions
  3151. //
  3152. //  Description:
  3153. //      Gets the real values from the nodes and sets the UI based
  3154. //        on these values.  This procedure updates all of the memory
  3155. //        and performance values. I guess hard-coding the render globals
  3156. //      name is okay until we handle multiple nodes, and since every
  3157. //      other routine in this file makes that assumption, so will I.
  3158. //
  3159.     checkBoxGrp -edit
  3160.         -v1 `getAttr defaultRenderGlobals.enableStrokeRender`
  3161.         enableStrokesCheck;
  3162.     
  3163.     checkBoxGrp -edit
  3164.         -v1 `getAttr defaultRenderGlobals.onlyRenderStrokes`
  3165.         onlyStrokesCheck;
  3166.     
  3167.     checkBoxGrp -edit
  3168.         -v1 `getAttr defaultRenderGlobals.oversamplePaintEffects`
  3169.         oversamplePaintEffectsCheck;
  3170.  
  3171.     checkBoxGrp -edit
  3172.         -v1 `getAttr defaultRenderGlobals.oversamplePfxPostFilter`
  3173.         oversamplePfxPostFilterCheck;
  3174.     
  3175.     string $strokesFile = `getAttr defaultRenderGlobals.strokesDepthFile`;
  3176.     textFieldGrp -edit 
  3177.         -fileName $strokesFile 
  3178.         depthStrokesCheck;
  3179.  
  3180.     // Now update the UI greyed/enabled state.
  3181.     int $value1 = `getAttr defaultRenderGlobals.enableStrokeRender`;
  3182.     if ($value1 == 1) {
  3183.         int $value2 = `getAttr defaultRenderGlobals.onlyRenderStrokes`;
  3184.         int $value3 = `getAttr defaultRenderGlobals.oversamplePaintEffects`;
  3185.         if ($value2 == 1) {
  3186.             textFieldGrp -edit -en true depthStrokesCheck;
  3187.         }
  3188.         else {
  3189.             textFieldGrp -edit -en false depthStrokesCheck;
  3190.         }
  3191.         if( $value3 == 1 ){
  3192.             checkBoxGrp -edit -en true oversamplePfxPostFilterCheck;
  3193.         } else {
  3194.             checkBoxGrp -edit -en false oversamplePfxPostFilterCheck;
  3195.         }
  3196.         checkBoxGrp -edit -en true onlyStrokesCheck;
  3197.         checkBoxGrp -edit -en true oversamplePaintEffectsCheck;
  3198.        } else {
  3199.            textFieldGrp -edit -en false depthStrokesCheck;
  3200.         checkBoxGrp -edit -en false  onlyStrokesCheck;
  3201.         checkBoxGrp -edit -en false  oversamplePaintEffectsCheck;
  3202.         checkBoxGrp -edit -en false  oversamplePfxPostFilterCheck;
  3203.     }
  3204. }
  3205.  
  3206. global proc setRenderGlobalsDepthFile()
  3207. {
  3208.     setAttr defaultRenderGlobals.strokesDepthFile -type "string"
  3209.         `textFieldGrp -q -fileName depthStrokesCheck`;
  3210. }
  3211.  
  3212. global proc createUrchinOptions (string $parent) 
  3213. //
  3214. //  Procedure Name:
  3215. //      createUrchinOptions
  3216. //
  3217. //  Description:
  3218. //      Creates the UI in the "Paint Effects Rendering Options" 
  3219. //        expand/collapse section.
  3220. //
  3221. {
  3222.     setUITemplate -pushTemplate attributeEditorTemplate;
  3223.  
  3224.     setParent $parent;
  3225.     string $cName;
  3226.  
  3227.     // If the UI is created already then just update the attribute values.
  3228.     if (`columnLayout -exists rgUrchinLayout`) {
  3229.         updateUrchinOptions;
  3230.         return;
  3231.     }
  3232.  
  3233.     columnLayout -adjustableColumn true rgUrchinLayout;
  3234.  
  3235.         checkBoxGrp -numberOfCheckBoxes 1
  3236.             -label1 "Enable Stroke Rendering" 
  3237.                 -cc "setAttr defaultRenderGlobals.enableStrokeRender #1; updateUrchinOptions;"
  3238.                 enableStrokesCheck;
  3239.  
  3240.         checkBoxGrp -numberOfCheckBoxes 1
  3241.             -label1 "Oversample" 
  3242.                 -cc "setAttr defaultRenderGlobals.oversamplePaintEffects #1; updateUrchinOptions;"
  3243.                 oversamplePaintEffectsCheck;
  3244.  
  3245.         checkBoxGrp -numberOfCheckBoxes 1
  3246.             -label1 "Oversample Post Filter" 
  3247.                 -cc "setAttr defaultRenderGlobals.oversamplePfxPostFilter #1; updateUrchinOptions;"
  3248.                 oversamplePfxPostFilterCheck;
  3249.         
  3250.         checkBoxGrp -numberOfCheckBoxes 1
  3251.             -label1 "Only Render Strokes" 
  3252.             -cc "setAttr defaultRenderGlobals.onlyRenderStrokes #1 ; updateUrchinOptions;"
  3253.             onlyStrokesCheck;
  3254.  
  3255.         textFieldGrp -label "Read This Depth File"
  3256.             -cc "setRenderGlobalsDepthFile"
  3257.             depthStrokesCheck;
  3258.  
  3259.     setParent ..;
  3260.     setUITemplate -popTemplate;
  3261.  
  3262.     // Make sure the values are right
  3263.     updateUrchinOptions;
  3264. }
  3265.  
  3266. //==================================================================
  3267. //
  3268. // Add Context Sensitive Help
  3269. //
  3270. //==================================================================
  3271.  
  3272. global proc buildRenderGlobalsContextHelpItems(string $nameRoot, string $menuParent)
  3273. {
  3274.     menuItem -label "Help on Render Globals..."
  3275.         -enableCommandRepeat false
  3276.         -command "showHelp RenderGlobals";
  3277. }
  3278.  
  3279. //==================================================================
  3280. //
  3281. // Support for Presets
  3282. //
  3283. //==================================================================
  3284.  
  3285. global proc renderGlobalsRevertToDefault()
  3286. {
  3287.     //
  3288.     // Description:
  3289.     //    This procedure is called when the user chooses Default Settings from
  3290.     //    the Presets->Load Preset menu.
  3291.     //    This procedure performs setAttrs on the attributes of the
  3292.     //    defaultRenderGlobals, defaultResolution and defaultRenderQuality nodes
  3293.     //    to set them to their default values.
  3294.     //    This procedure does not attempt to deal with resolution or quality
  3295.     //    nodes other than the two default nodes. In the future, this procedure
  3296.     //    will be replaced by functionality in the nodePreset command that can
  3297.     //    set an arbitrary node back to its default values.
  3298.     //
  3299.  
  3300.     // Set defaultRenderGlobals to default values
  3301.     //
  3302.     setAttr "defaultRenderGlobals.caching" no;
  3303.     setAttr "defaultRenderGlobals.isHistoricallyInteresting" 2;
  3304.     setAttr "defaultRenderGlobals.nodeState" 0;
  3305.     setAttr "defaultRenderGlobals.renderAll" yes;
  3306.     setAttr "defaultRenderGlobals.ignoreFilmGate" yes;
  3307.     setAttr "defaultRenderGlobals.clipFinalShadedColor" yes;
  3308.     setAttr "defaultRenderGlobals.enableDepthMaps" yes;
  3309.     setAttr "defaultRenderGlobals.enableDefaultLight" yes;
  3310.     setAttr "defaultRenderGlobals.enableStrokeRender" yes;
  3311.     setAttr "defaultRenderGlobals.oversamplePaintEffects" no;
  3312.     setAttr "defaultRenderGlobals.oversamplePfxPostFilter" no;
  3313.     setAttr "defaultRenderGlobals.onlyRenderStrokes" no;
  3314.     setAttr "defaultRenderGlobals.strokesDepthFile" -type "string" "";
  3315.     setAttr "defaultRenderGlobals.imageFormat" 7;
  3316.     setAttr "defaultRenderGlobals.pluginFormat" -type "string" "";
  3317.     setAttr "defaultRenderGlobals.gammaCorrection" 1;
  3318.     setAttr "defaultRenderGlobals.topRegion" 256;
  3319.     setAttr "defaultRenderGlobals.leftRegion" 0;
  3320.     setAttr "defaultRenderGlobals.bottomRegion" 0;
  3321.     setAttr "defaultRenderGlobals.rightRegion" 256;
  3322.     setAttr "defaultRenderGlobals.useRenderRegion" no;
  3323.     setAttr "defaultRenderGlobals.animation" no;
  3324.     setAttr "defaultRenderGlobals.animationRange" 1;
  3325.     setAttr "defaultRenderGlobals.startFrame" 1;
  3326.     setAttr "defaultRenderGlobals.endFrame" 10;
  3327.     setAttr "defaultRenderGlobals.byFrame" 1;
  3328.     setAttr "defaultRenderGlobals.byFrameStep" 1;
  3329.     setAttr "defaultRenderGlobals.modifyExtension" no;
  3330.     setAttr "defaultRenderGlobals.startExtension" 1;
  3331.     setAttr "defaultRenderGlobals.byExtension" 1;
  3332.     setAttr "defaultRenderGlobals.extensionPadding" 1;
  3333.     setAttr "defaultRenderGlobals.fieldExtControl" 0;
  3334.     setAttr "defaultRenderGlobals.stereoExtControl" 0;
  3335.     setAttr "defaultRenderGlobals.outFormatControl" 0;
  3336.     setAttr "defaultRenderGlobals.oddFieldExt" -type "string" "";
  3337.     setAttr "defaultRenderGlobals.evenFieldExt" -type "string" "";
  3338.     setAttr "defaultRenderGlobals.leftStereoExt" -type "string" "";
  3339.     setAttr "defaultRenderGlobals.rightStereoExt" -type "string" "";
  3340.     setAttr "defaultRenderGlobals.outFormatExt" -type "string" "";
  3341.     setAttr "defaultRenderGlobals.useMayaFileName" yes;
  3342.     setAttr "defaultRenderGlobals.useFrameExt" no;
  3343.     setAttr "defaultRenderGlobals.putFrameBeforeExt" no;
  3344.     setAttr "defaultRenderGlobals.imageFilePrefix" -type "string" "";
  3345.     setAttr "defaultRenderGlobals.periodInExt" yes;
  3346.     setAttr "defaultRenderGlobals.composite" no;
  3347.     setAttr "defaultRenderGlobals.compositeThreshold" 0;
  3348.     setAttr "defaultRenderGlobals.shadowsObeyLightLinking" yes;
  3349.     setAttr "defaultRenderGlobals.recursionDepth" 2;
  3350.     setAttr "defaultRenderGlobals.leafPrimitives" 200;
  3351.     setAttr "defaultRenderGlobals.subdivisionPower" 0.25;
  3352.     setAttr "defaultRenderGlobals.subdivisionHashSize" 5;
  3353.     setAttr "defaultRenderGlobals.logRenderPerformance" no;
  3354.     setAttr "defaultRenderGlobals.geometryVector" 20;
  3355.     setAttr "defaultRenderGlobals.shadingVector" 60;
  3356.     setAttr "defaultRenderGlobals.maximumMemory" 48;
  3357.     setAttr "defaultRenderGlobals.numCpusToUse" 0;
  3358.     setAttr "defaultRenderGlobals.shadowPass" no;
  3359.     setAttr "defaultRenderGlobals.iprShadowPass" no;
  3360.     setAttr "defaultRenderGlobals.useFileCache" yes;
  3361.     setAttr "defaultRenderGlobals.optimizeInstances" yes;
  3362.     setAttr "defaultRenderGlobals.reuseTessellations" yes;
  3363.     setAttr "defaultRenderGlobals.motionBlur" no;
  3364.     setAttr "defaultRenderGlobals.motionBlurByFrame" 1;
  3365.     setAttr "defaultRenderGlobals.applyFogInPost" no;
  3366.     setAttr "defaultRenderGlobals.postFogBlur" 1;
  3367.     setAttr "defaultRenderGlobals.preRenderMel" -type "string" "";
  3368.     setAttr "defaultRenderGlobals.postRenderMel" -type "string" "";
  3369.     setAttr "defaultRenderGlobals.preFurRenderMel" -type "string" "";
  3370.     setAttr "defaultRenderGlobals.postFurRenderMel" -type "string" "";
  3371.     setAttr "defaultRenderGlobals.createIprFile" no;
  3372.     setAttr "defaultRenderGlobals.blurLength" 1;
  3373.     setAttr "defaultRenderGlobals.blurSharpness" 1;
  3374.     setAttr "defaultRenderGlobals.smoothValue" 2;
  3375.     setAttr "defaultRenderGlobals.useBlur2DMemoryCap" yes;
  3376.     setAttr "defaultRenderGlobals.blur2DMemoryCap" 200;
  3377.     setAttr "defaultRenderGlobals.motionBlurType" 1;
  3378.     setAttr "defaultRenderGlobals.useDisplacementBoundingBox" yes;
  3379.     setAttr "defaultRenderGlobals.smoothColor" no;
  3380.     setAttr "defaultRenderGlobals.keepMotionVector" no;
  3381.     setAttr "defaultRenderGlobals.iprRenderShading" yes;
  3382.     setAttr "defaultRenderGlobals.iprRenderShadowMaps" yes;
  3383.     setAttr "defaultRenderGlobals.iprRenderMotionBlur" yes;
  3384.     setAttr "defaultRenderGlobals.renderLayerEnable" no;
  3385.     setAttr "defaultRenderGlobals.renderLayerPassEnable" no;
  3386.     setAttr "defaultRenderGlobals.renderGlobalPassEnable" no;
  3387.     setAttr "defaultRenderGlobals.renderLayerSubdirs" no;
  3388.     setAttr "defaultRenderGlobals.forceTileSize" no;
  3389.     setAttr "defaultRenderGlobals.tileWidth" 64;
  3390.     setAttr "defaultRenderGlobals.tileHeight" 64;
  3391.  
  3392.     // Set defaultRenderQuality to default values
  3393.     //
  3394.     setAttr "defaultRenderQuality.caching" no;
  3395.     setAttr "defaultRenderQuality.isHistoricallyInteresting" 2;
  3396.     setAttr "defaultRenderQuality.nodeState" 0;
  3397.     setAttr "defaultRenderQuality.reflections" 1;
  3398.     setAttr "defaultRenderQuality.refractions" 6;
  3399.     setAttr "defaultRenderQuality.shadows" 2;
  3400.     setAttr "defaultRenderQuality.rayTraceBias" 0;
  3401.     setAttr "defaultRenderQuality.edgeAntiAliasing" 3;
  3402.     setAttr "defaultRenderQuality.renderSample" no;
  3403.     setAttr "defaultRenderQuality.useMultiPixelFilter" no;
  3404.     setAttr "defaultRenderQuality.pixelFilterType" 2;
  3405.     setAttr "defaultRenderQuality.pixelFilterWidthX" 2.2000000476837158;
  3406.     setAttr "defaultRenderQuality.pixelFilterWidthY" 2.2000000476837158;
  3407.     setAttr "defaultRenderQuality.plugInFilterWeight" 1;
  3408.     setAttr "defaultRenderQuality.shadingSamples" 1;
  3409.     setAttr "defaultRenderQuality.maxShadingSamples" 8;
  3410.     setAttr "defaultRenderQuality.visibilitySamples" 1;
  3411.     setAttr "defaultRenderQuality.maxVisibilitySamples" 4;
  3412.     setAttr "defaultRenderQuality.volumeSamples" 1;
  3413.     setAttr "defaultRenderQuality.particleSamples" 1;
  3414.     setAttr "defaultRenderQuality.enableRaytracing" no;
  3415.     setAttr "defaultRenderQuality.redThreshold" 0.40000000596046448;
  3416.     setAttr "defaultRenderQuality.greenThreshold" 0.30000001192092896;
  3417.     setAttr "defaultRenderQuality.blueThreshold" 0.60000002384185791;
  3418.     setAttr "defaultRenderQuality.coverageThreshold" 0.125;
  3419.  
  3420.     // Set defaultResolution to default values
  3421.     //
  3422.     setAttr "defaultResolution.caching" no;
  3423.     setAttr "defaultResolution.isHistoricallyInteresting" 2;
  3424.     setAttr "defaultResolution.nodeState" 0;
  3425.     setAttr "defaultResolution.width" 320;
  3426.     setAttr "defaultResolution.height" 240;
  3427.     setAttr "defaultResolution.pixelAspect" 0;
  3428.     setAttr "defaultResolution.aspectLock" no;
  3429.     setAttr "defaultResolution.deviceAspectRatio" 1.3333300352096558;
  3430.     setAttr "defaultResolution.lockDeviceAspectRatio" no;
  3431.     setAttr "defaultResolution.oddFieldFirst" yes;
  3432.     setAttr "defaultResolution.fields" 0;
  3433.     setAttr "defaultResolution.zerothScanline" 0;
  3434. }
  3435.  
  3436. global proc buildRenderGlobalsPresetsMenu()
  3437. {
  3438.     //
  3439.     // Description:
  3440.     //    This procedure builds the Presets menu in the render globals window.
  3441.     //
  3442.  
  3443.     setParent renderGlobalsWindow;
  3444.     menu -edit -deleteAllItems presetsMenu;
  3445.  
  3446.     setParent -menu presetsMenu;
  3447.  
  3448.     menuItem 
  3449.         -label "Save Settings as Preset..."
  3450.         -command ("saveNodePresetDialog");
  3451.  
  3452.     string $presetArray[];
  3453.     $presetArray = `nodePreset -list defaultRenderGlobals`;
  3454.  
  3455.     menuItem 
  3456.         -label "Load Preset"
  3457.         -subMenu true;
  3458.     
  3459.         menuItem 
  3460.             -label "Default Settings"
  3461.             -command 
  3462.                 ("renderGlobalsRevertToDefault; updateAllRenderGlobals;");
  3463.         
  3464.         menuItem -divider true;
  3465.  
  3466.         // Add a menu item for each available preset.
  3467.         //
  3468.         int $i;
  3469.         for ($i = 0; $i < size($presetArray); $i++)
  3470.         {
  3471.             menuItem
  3472.                 -label $presetArray[$i]
  3473.                 -command (
  3474.                     "nodePreset -load defaultRenderGlobals \""
  3475.                         + $presetArray[$i]
  3476.                         + "\"; "
  3477.                         + "nodePreset -load defaultRenderQuality \""
  3478.                         + $presetArray[$i]
  3479.                         + "\"; "
  3480.                         + "nodePreset -load defaultResolution \""
  3481.                         + $presetArray[$i]
  3482.                         + "\"; "
  3483.                         + "updateAllRenderGlobals");
  3484.         }
  3485.     setParent -menu ..; // from Load Preset menu
  3486.     menuItem 
  3487.         -label "Delete Preset"
  3488.         -subMenu true;
  3489.     
  3490.         if (size($presetArray) == 0)
  3491.         {
  3492.             menuItem 
  3493.                 -label "No Presets Currently Exist"
  3494.                 -enable false;
  3495.         }
  3496.         else
  3497.         {
  3498.             // Add a menu item to be able to delete each available preset.
  3499.             //
  3500.             int $i;
  3501.             for ($i = 0; $i < size($presetArray); $i++)
  3502.             {
  3503.                 menuItem
  3504.                     -label $presetArray[$i]
  3505.                     -command (
  3506.                         "nodePresetConfirmDeleteDialog \""
  3507.                             + $presetArray[$i]
  3508.                             + "\"; ");
  3509.             }
  3510.         }
  3511.     setParent -menu ..; // from Delete Preset menu
  3512.  
  3513.     menuItem
  3514.         -label "Set Preferred Preset"
  3515.         -subMenu true;
  3516.         
  3517.         int $preferredPresetExists;
  3518.         string $preferredPresetName;
  3519.  
  3520.         if (`optionVar -exists defaultRenderGlobalsPreferredPreset`)
  3521.         {
  3522.             $preferredPresetExists = true;
  3523.             $preferredPresetName = 
  3524.                 `optionVar -query defaultRenderGlobalsPreferredPreset`;
  3525.         }
  3526.  
  3527.         menuItem 
  3528.             -label "Default Settings"
  3529.             -checkBox (!$preferredPresetExists)
  3530.             -command (
  3531.                 "optionVar -remove defaultRenderGlobalsPreferredPreset;"
  3532.                 + "optionVar -remove defaultRenderQualityPreferredPreset;"
  3533.                 + "optionVar -remove defaultResolutionPreferredPreset;");
  3534.  
  3535.         menuItem -divider true;
  3536.  
  3537.         // Add a menu item to be able to set each available preset as your
  3538.         // preferred preset (to which render globals will be initialized
  3539.         // when you create a new file).
  3540.         //
  3541.         int $i;
  3542.         int $checkBoxValue;
  3543.  
  3544.         for ($i = 0; $i < size($presetArray); $i++)
  3545.         {
  3546.             $checkBoxValue = false;
  3547.             if ($preferredPresetExists)
  3548.             {
  3549.                 $checkBoxValue = ($presetArray[$i] == $preferredPresetName);
  3550.             }
  3551.             menuItem
  3552.                 -label $presetArray[$i]
  3553.                 -checkBox $checkBoxValue
  3554.                 -command (
  3555.                     "optionVar -stringValue " 
  3556.                         + "\"defaultRenderGlobalsPreferredPreset\" \""
  3557.                         + $presetArray[$i] 
  3558.                         + "\"; optionVar -stringValue " 
  3559.                         + "\"defaultRenderQualityPreferredPreset\" \""
  3560.                         + $presetArray[$i] 
  3561.                         + "\"; optionVar -stringValue " 
  3562.                         + "\"defaultResolutionPreferredPreset\" \""
  3563.                         + $presetArray[$i] 
  3564.                         + "\";");
  3565.         }
  3566.     setParent -menu ..; // from Set Preferred Preset menu
  3567. }
  3568.  
  3569. //==================================================================
  3570. //
  3571. // Starting the Window building section
  3572. //
  3573. //==================================================================
  3574.  
  3575. global proc renderGlobalsWindow () 
  3576. //
  3577. //  Procedure Name:
  3578. //      renderGlobalsWindow
  3579. //
  3580. //  Description:
  3581. //        This procedure only builds the UI for the window.
  3582. //        The update* procedures make sure that the values are valid.
  3583. //        And the change* procedures do the editting of the values.
  3584. //
  3585. {
  3586.     // Unless the user has set the USE_OLD_RENDER_GLOBALS_WINDOW environment
  3587.     // variable, we will open the new unified render globals window.
  3588.     //
  3589.     if (size(`getenv "USE_OLD_RENDER_GLOBALS_WINDOW"`) == 0)
  3590.     {
  3591.         unifiedRenderGlobalsWindow();
  3592.         return;
  3593.     }
  3594.  
  3595.     // If the window exists already, just show it.
  3596.     //
  3597.     if (`window -exists renderGlobalsWindow`) {
  3598.         showWindow renderGlobalsWindow;
  3599.         updateAllRenderGlobals;
  3600.         return;
  3601.     }    
  3602.  
  3603.     // Create the window
  3604.     //
  3605.     window -title "Render Globals" 
  3606.         -wh 422 670 -tlc 200 220 
  3607.         -mb true -retain
  3608.         -iconName "R.Globals" renderGlobalsWindow;
  3609.  
  3610.     // Set up the menus
  3611.     //
  3612.     menu -l "Edit";
  3613.     menuItem -l "Hardware Render Globals..."
  3614.         -c "editRenderGlobalsRW";
  3615.     menuItem -l "Change Project Image Directory..."
  3616.         -c "EditProject";
  3617.  
  3618.     menu -label "Presets"
  3619.         -postMenuCommand "buildRenderGlobalsPresetsMenu"
  3620.         presetsMenu;
  3621.  
  3622.     //    Adds support for the Context Sensitive Help Menu.
  3623.     //
  3624.     addContextHelpProc "renderGlobalsWindow" "buildRenderGlobalsContextHelpItems";
  3625.  
  3626.     doHelpMenu "renderGlobalsWindow" "renderGlobalsWindow";
  3627.  
  3628.     setUITemplate -pushTemplate attributeEditorTemplate;
  3629.  
  3630.     formLayout rgMainForm;
  3631.  
  3632.     //--------------------------------------------------------------          
  3633.     // Example File Name area
  3634.     //--------------------------------------------------------------          
  3635.     
  3636.     frameLayout -labelVisible false -cll false -cl false exampleLayout;
  3637.     columnLayout -adjustableColumn true;
  3638.         text -align "left" -font "boldLabelFont" -label "" exampleText0;
  3639.         text -align "left" -font "boldLabelFont" -label "" exampleText1;
  3640.         text -align "left" -font "boldLabelFont" -label "" exampleText2;
  3641.  
  3642.     setParent ..;
  3643.     setParent ..;
  3644.  
  3645.     //--------------------------------------------------------------          
  3646.     // Information area starts
  3647.     //--------------------------------------------------------------          
  3648.     
  3649.     scrollLayout -hst 0 rgMainLayout;
  3650.     string $parent = `columnLayout -adjustableColumn true`;
  3651.  
  3652.     // Image File Name
  3653.     //
  3654.     frameLayout -label "Image File Output" 
  3655.         -cll true -cl 0
  3656.         rgImageFileFrame;
  3657.     
  3658.         // This section defaults open so always create the UI
  3659.         createImageFile ("rgImageFileFrame");
  3660.  
  3661.     setParent ..;
  3662.  
  3663.     // Resolution Section
  3664.     //
  3665.     frameLayout -label "Resolution" 
  3666.         -cll true -cl 1
  3667.         -preExpandCommand "createResolution (\"rgResolutionFrame\")" 
  3668.         rgResolutionFrame;
  3669.     setParent ..;
  3670.  
  3671.     // Field Options
  3672.     //
  3673.     frameLayout -label "Field Options" 
  3674.         -cll true -cl 1
  3675.         -preExpandCommand "createFieldOptions (\"rgFieldOptionsFrame\")" 
  3676.         rgFieldOptionsFrame;
  3677.     setParent ..;            
  3678.     
  3679.     // Anti-aliasing quality section
  3680.     //
  3681.     frameLayout -label "Anti-aliasing Quality" 
  3682.         -cll true -cl 1
  3683.         -preExpandCommand "createRenderQuality (\"rgQualityFrame\")" 
  3684.         rgQualityFrame;
  3685.     setParent ..;
  3686.  
  3687.     // Raytracing quality section
  3688.     //
  3689.     frameLayout -label "Raytracing Quality" 
  3690.         -cll true -cl 1
  3691.         -preExpandCommand "createRayTraceQuality (\"rgRayTraceFrame\")" 
  3692.         rgRayTraceFrame;
  3693.     setParent ..;
  3694.     
  3695.  
  3696.     // Extension Options
  3697.     //
  3698.     frameLayout -label "Modify Extension" 
  3699.         -cll true -cl 1
  3700.         rgExtOptionsFrame;
  3701.         
  3702.         // Always create this since it is needed by the first section
  3703.         createExtensionOptions ("rgExtOptionsFrame");
  3704.         
  3705.     setParent ..;
  3706.  
  3707.     // Frame Options
  3708.     //
  3709.     frameLayout -label "Renumber Frames" 
  3710.         -cll true -cl 1
  3711.         -preExpandCommand "createFrameOptions (\"rgFrameOptionsFrame\")" 
  3712.         rgFrameOptionsFrame;
  3713.     setParent ..;
  3714.  
  3715.     // Motion Blur
  3716.     //
  3717.     frameLayout -label "Motion Blur" 
  3718.         -cll true -cl 1
  3719.         -preExpandCommand "createMotionBlur (\"rgBlurFrame\")" 
  3720.         rgBlurFrame;
  3721.     setParent ..;            
  3722.  
  3723.     // Render Options
  3724.     //
  3725.     frameLayout -label "Render Options"
  3726.         -cll true -cl 1
  3727.         -preExpandCommand "createRenderOptions (\"rgOptionFrame\")" 
  3728.         rgOptionFrame;
  3729.     setParent ..;
  3730.  
  3731.     // Performance Options
  3732.     //
  3733.     frameLayout -label "Memory and Performance Options"
  3734.         -cll true -cl 1
  3735.         -preExpandCommand "createPerformanceOptions (\"rgPerfFrame\")" 
  3736.         rgPerfFrame;
  3737.     setParent ..;
  3738.  
  3739.     // IPR Options
  3740.     //
  3741.     frameLayout -label "IPR Options"
  3742.         -cll true -cl 1
  3743.         rgIPRFrame;
  3744.     createIPROptions("rgIPRFrame"); 
  3745.     setParent ..;
  3746.  
  3747.     // Render Layer/Pass Options
  3748.     //
  3749.     frameLayout -label "Render Layer/Pass Control"
  3750.         -cll true -cl 1
  3751.         -preExpandCommand "createRenderLayerOptions (\"rgRenderLayerFrame\")"
  3752.         rgRenderLayerFrame;
  3753.     setParent ..;
  3754.  
  3755.     if (`isTrue MayaCreatorExists`) {
  3756.         // Urchin Options
  3757.         frameLayout -label "Paint Effects Rendering Options"
  3758.             -cll true -cl 1
  3759.             -preExpandCommand "createUrchinOptions (\"rgUrchinFrame\")"
  3760.             rgUrchinFrame;
  3761.         setParent ..;
  3762.     }
  3763.  
  3764.     // These end off the layouts of the information area
  3765.     setParent ..;
  3766.     setParent ..;
  3767.  
  3768.     //--------------------------------------------------------------          
  3769.     // Button area starts
  3770.     //--------------------------------------------------------------          
  3771.  
  3772.     button -l "Close" 
  3773.         -h 26
  3774.         -align "center"
  3775.         -c "window -e -vis 0 renderGlobalsWindow" 
  3776.         rgCloseBtn;
  3777.  
  3778.     setParent ..;
  3779.  
  3780.     // Fix up the layout
  3781.     
  3782.     formLayout -edit
  3783.     
  3784.         -af exampleLayout "top" 0 
  3785.         -af exampleLayout "left" 0 
  3786.         -an exampleLayout "bottom"
  3787.         -af exampleLayout "right" 0 
  3788.  
  3789.         -ac rgMainLayout "top" 5 exampleLayout
  3790.         -af rgMainLayout "left" 0 
  3791.         -af rgMainLayout "right" 0 
  3792.         -ac rgMainLayout "bottom" 5 rgCloseBtn
  3793.  
  3794.         -an rgCloseBtn "top"
  3795.         -af rgCloseBtn "bottom" 5
  3796.         -af rgCloseBtn "left" 5
  3797.         -af rgCloseBtn "right" 5
  3798.         rgMainForm;
  3799.  
  3800.     setUITemplate -popTemplate ;
  3801.  
  3802.     //--------------------------------------------------------------
  3803.     // Update and show window
  3804.     //--------------------------------------------------------------
  3805.  
  3806.     updateImageDirectory;
  3807.     updateImageFile;
  3808.     updateRenderableCamera;
  3809.     updateFrames;
  3810.     updateFileOutputFeedback;
  3811.     
  3812.     showWindow renderGlobalsWindow;
  3813.  
  3814.     // The -replacePrevious flag removes all scriptJobs from
  3815.     // this window.  Then these two are added back.
  3816.     //
  3817.     scriptJob -p renderGlobalsWindow -replacePrevious
  3818.         -e SceneOpened updateAllRenderGlobals;
  3819.  
  3820.     scriptJob -p renderGlobalsWindow
  3821.         -e workspaceChanged updateImageDirectory;
  3822.  
  3823. }
  3824.  
  3825. global proc updateAllRenderGlobals()
  3826. {
  3827.     updateImageFile;
  3828.     updateRenderableCamera;
  3829.     updateFrames;
  3830.     updateFileOutputFeedback;
  3831.     if (`frameLayout -q -cl rgResolutionFrame` == 0) {
  3832.         updateResolution;
  3833.     }
  3834.     if (`frameLayout -q -cl rgQualityFrame` == 0) {
  3835.         updateRenderQuality;
  3836.     }
  3837.     if (`frameLayout -q -cl rgRayTraceFrame` == 0) {
  3838.         updateRaytraceQuality;
  3839.     }
  3840.     if (`frameLayout -q -cl rgExtOptionsFrame` == 0) {
  3841.         updateExtOptions;
  3842.     }
  3843.     if (`frameLayout -q -cl rgFieldOptionsFrame` == 0) {
  3844.         updateFieldOptions;
  3845.     }
  3846.     if (`frameLayout -q -cl rgBlurFrame` == 0) {
  3847.         updateMotionBlur;
  3848.     }
  3849.     if (`frameLayout -q -cl rgOptionFrame` == 0) {
  3850.         updateRenderOptions;
  3851.     }
  3852.     if (`frameLayout -q -cl rgPerfFrame` == 0) {
  3853.         updatePerformanceOptions;
  3854.     }
  3855.     if (`frameLayout -q -cl rgIPRFrame` == 0) {
  3856.         updateIPROptions;
  3857.     }
  3858.     if (`frameLayout -q -cl rgRenderLayerFrame` == 0) {
  3859.         updateRenderLayerOptions;
  3860.     }
  3861.     if (`isTrue MayaCreatorExists`) {
  3862.         if (`frameLayout -q -cl rgUrchinFrame` == 0) {
  3863.             updateUrchinOptions;
  3864.         }
  3865.     }
  3866. }
  3867.  
  3868. global proc checkAspectLockWidth ( string $nodeName )
  3869. {
  3870.     float $deviceAspect;
  3871.  
  3872.     if ( `getAttr ( $nodeName + ".aspectLock" )` ) {
  3873.         // AEadjustHeight
  3874.         int $value = `getAttr ( $nodeName + ".width" )`;
  3875.     
  3876.         float $aspect = `getAttr ( $nodeName + ".pixelAspect" )`;
  3877.     
  3878.         if ( $aspect > 0.0 ){
  3879.             int $rez = $aspect * $value;
  3880.             int $oldrez = `getAttr ( $nodeName + ".height" )`;
  3881.             if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
  3882.                 setAttr ( $nodeName + ".height" ) $rez;
  3883.             }
  3884.         } else {
  3885.             checkAspectLock $nodeName;
  3886.         }
  3887.     }
  3888.  
  3889.     if ( `getAttr ( $nodeName + ".lockDeviceAspectRatio" )` == 0 ) {
  3890.         $deviceAspect = `getAttr ( $nodeName + ".width" )`;
  3891.         $deviceAspect = $deviceAspect / `getAttr ( $nodeName + ".height" )`;
  3892.         setAttr ( $nodeName + ".deviceAspectRatio" ) $deviceAspect;
  3893.     }
  3894. }
  3895.  
  3896. global proc checkAspectLockHeight ( string $nodeName )
  3897. {
  3898.     float $deviceAspect;
  3899.  
  3900.     if ( `getAttr ( $nodeName + ".aspectLock" )` ) {
  3901.         // AEadjustWidth
  3902.         int $value = `getAttr ( $nodeName + ".height" )`;
  3903.         
  3904.         float $aspect = `getAttr ( $nodeName + ".pixelAspect" )`;
  3905.     
  3906.         if ( $aspect > 0.0 ){
  3907.             int $rez = $value / $aspect;
  3908.             int $oldrez = `getAttr ( $nodeName + ".width" )`;
  3909.             if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
  3910.                 setAttr ( $nodeName + ".width" ) $rez;
  3911.             }
  3912.         } else {
  3913.             checkAspectLock $nodeName;
  3914.         }
  3915.     }
  3916.  
  3917.     if ( `getAttr ( $nodeName + ".lockDeviceAspectRatio" )` == 0 ) {
  3918.         $deviceAspect = `getAttr ( $nodeName + ".width" )`;
  3919.         $deviceAspect = $deviceAspect / `getAttr ( $nodeName + ".height" )`;
  3920.         setAttr ( $nodeName + ".deviceAspectRatio" ) $deviceAspect;
  3921.     }
  3922. }
  3923.  
  3924. global proc checkAspectLock ( string $nodeName )
  3925. {
  3926.     // AEadjustPixelAspect
  3927.     int $lockOn = `getAttr ( $nodeName + ".aspectLock" )`;
  3928.  
  3929.     if ($lockOn) {
  3930.         float $h = `getAttr ( $nodeName + ".height" )`;
  3931.         float $w = `getAttr ( $nodeName + ".width" )`;
  3932.         float $aspect = $h / $w;
  3933.         setAttr ( $nodeName + ".pixelAspect" ) $aspect;
  3934.     } else {
  3935.         setAttr ( $nodeName + ".pixelAspect" ) 0.0;
  3936.     }
  3937. }
  3938.  
  3939. global proc rgPixelAspectReplace(string $nodeName)
  3940. {
  3941.     string $aspectAttr = $nodeName + ".deviceAspectRatio";
  3942.     string $widthAttr = $nodeName + ".width";
  3943.     string $heightAttr = $nodeName + ".height";
  3944.     float  $aspect = (float) `getAttr $widthAttr` / (float) `getAttr $heightAttr`;
  3945.     $aspect = `getAttr $aspectAttr` / $aspect;
  3946.  
  3947.     floatFieldGrp -e -v1 $aspect pixRatio;
  3948. }
  3949.  
  3950. global proc rgAdjustPixelAspect(string $nodeName)
  3951. {
  3952.     setParent renderGlobalsWindow;
  3953.     string $aspectAttr = $nodeName + ".deviceAspectRatio";
  3954.     string $widthAttr = $nodeName + ".width";
  3955.     string $heightAttr = $nodeName + ".height";
  3956.     float  $pixelAspect = (float) `getAttr $widthAttr`
  3957.                             / (float) `getAttr $heightAttr`;
  3958.     $pixelAspect = `getAttr $aspectAttr` / $pixelAspect;
  3959.     floatFieldGrp -e -v1 $pixelAspect pixRatio;
  3960. }
  3961.  
  3962. global proc rgAdjustDeviceAspect(string $nodeName)
  3963. {
  3964.     setParent renderGlobalsWindow;
  3965.     string $devAspectAttr = $nodeName + ".deviceAspectRatio";
  3966.     string $widthAttr = $nodeName + ".width";
  3967.     string $heightAttr = $nodeName + ".height";
  3968.  
  3969.     float $pixelAspect = `floatFieldGrp -q -v1 pixRatio`;
  3970.     float $aspect = (float) `getAttr $widthAttr`
  3971.                     / (float) `getAttr $heightAttr`;
  3972.     $aspect = $pixelAspect * $aspect;
  3973.     setAttr $devAspectAttr $aspect;
  3974.     floatFieldGrp -edit -v1 $aspect resRatio;
  3975. }
  3976.  
  3977. global proc updateDeviceAspectRatio()
  3978. {
  3979.     setAttr defaultResolution.deviceAspectRatio
  3980.         `floatFieldGrp -q -v1 resRatio`;
  3981.     rgAdjustPixelAspect "defaultResolution";
  3982.     updateResolution;
  3983. }
  3984.  
  3985. global proc updateRenderLayerLayout( int $doLayers, int $doPasses )
  3986. {
  3987.     updateRenderLayerFilters;
  3988.  
  3989.     if ( $doLayers )
  3990.     {
  3991.         if ( $doPasses )
  3992.         {
  3993.             spreadSheetEditor
  3994.                 -e
  3995.                 -filter renderLayerFilter
  3996.                 -fal {"rndr","b","cp","s","di","sp"}
  3997.                 "layerOutliner";
  3998.  
  3999.         }
  4000.         else
  4001.         {
  4002.             spreadSheetEditor
  4003.                 -e
  4004.                 -filter renderLayerFilter
  4005.                 -fal {"rndr"}
  4006.                 "layerOutliner";
  4007.  
  4008.         }
  4009.  
  4010.         checkBoxGrp -e        
  4011.             -ed true
  4012.             -en1 true
  4013.             renderLayerPassEnable;    
  4014.  
  4015.         checkBoxGrp -e        
  4016.             -ed false
  4017.             -en1 false
  4018.             renderGlobalPassEnable;    
  4019.  
  4020.         frameLayout
  4021.             -e
  4022.             -m true
  4023.             "layerAttrLayout";
  4024.  
  4025.     }
  4026.     else
  4027.     {
  4028.         if ( $doPasses )
  4029.         {
  4030.             spreadSheetEditor
  4031.                 -e
  4032.                 -filter glblRenderFilter
  4033.                 -fal {"b","cp","s","di","sp"}
  4034.                 "layerOutliner";
  4035.  
  4036.             frameLayout
  4037.                 -e
  4038.                 -m true
  4039.                 "layerAttrLayout";
  4040.  
  4041.         }
  4042.         else
  4043.         {
  4044.             frameLayout
  4045.                 -e
  4046.                 -m false
  4047.                 "layerAttrLayout";
  4048.         }
  4049.  
  4050.         checkBoxGrp -e        
  4051.             -ed true
  4052.             -en1 true 
  4053.             renderGlobalPassEnable;    
  4054.  
  4055.         checkBoxGrp -e        
  4056.             -ed false
  4057.             -en1 false 
  4058.             renderLayerPassEnable;    
  4059.     }
  4060. }
  4061.  
  4062. global proc updateRenderLayerOptions ()
  4063. //
  4064. //  Procedure Name:
  4065. //      updateRenderLayerOptions
  4066. //
  4067. //  Description:
  4068. //      Gets the real values from the option vars and sets the UI based
  4069. //        on these values.  This procedure updates all of the RL/RP
  4070. //        values.
  4071. //
  4072.     int $doLayers = `getAttr "defaultRenderGlobals.renderLayerEnable"`;
  4073.     checkBoxGrp -edit -v1 $doLayers renderLayerEnable;
  4074.  
  4075.     int $doLayerPasses = `getAttr "defaultRenderGlobals.renderLayerPassEnable"`;
  4076.     checkBoxGrp -edit -v1 $doLayerPasses renderLayerPassEnable;
  4077.  
  4078.     int $doGlobalPasses = `getAttr "defaultRenderGlobals.renderGlobalPassEnable"`;
  4079.     checkBoxGrp -edit -v1 $doGlobalPasses renderGlobalPassEnable;
  4080.  
  4081.     int $doSubdirs = `getAttr "defaultRenderGlobals.renderLayerSubdirs"`;
  4082.     checkBoxGrp -edit -v1 $doSubdirs renderLayerSubdirs;
  4083.     
  4084.     if ( $doLayers ) {
  4085.         updateRenderLayerLayout( true, $doLayerPasses );
  4086.     }
  4087.     else {
  4088.         updateRenderLayerLayout( false, $doGlobalPasses );
  4089.     }    
  4090. }
  4091.  
  4092. global proc updateRenderLayerEnable()
  4093. {
  4094.     int $doPasses;
  4095.     int $doLayers = `checkBoxGrp -q -v1 renderLayerEnable`;
  4096.     setAttr defaultRenderGlobals.renderLayerEnable $doLayers;
  4097.     if ( $doLayers ) {
  4098.         $doPasses = `checkBoxGrp -q -v1 renderLayerPassEnable`;
  4099.     }
  4100.     else {
  4101.         $doPasses = `checkBoxGrp -q -v1 renderGlobalPassEnable`;
  4102.     }
  4103.  
  4104.     updateRenderLayerLayout( $doLayers, $doPasses );
  4105. }
  4106.  
  4107. global proc updateRenderLayerPassEnable()
  4108. {
  4109.     int $doLayers = `checkBoxGrp -q -v1 renderLayerEnable`;
  4110.     int $doPasses = `checkBoxGrp -q -v1 renderLayerPassEnable`;
  4111.     setAttr defaultRenderGlobals.renderLayerPassEnable $doPasses;
  4112.     updateRenderLayerLayout( $doLayers, $doPasses );
  4113. }
  4114.  
  4115. global proc updateRenderGlobalPassEnable()
  4116. {
  4117.     int $doLayers = `checkBoxGrp -q -v1 renderLayerEnable`;
  4118.     int $doPasses = `checkBoxGrp -q -v1 renderGlobalPassEnable`;
  4119.     setAttr defaultRenderGlobals.renderGlobalPassEnable $doPasses;
  4120.     updateRenderLayerLayout( $doLayers, $doPasses );
  4121. }
  4122.  
  4123. //global proc updateRenderLayerSubdirs()
  4124. //{
  4125.     //int $doSubdirs = `checkBoxGrp -q -v1 renderLayerSubdirs`;
  4126.     //setAttr defaultRenderGlobals.renderLayerSubdirs $doPasses;
  4127.     //////////optionVar -intValue renderLayerSubdirs $doSubdirs;
  4128. //}
  4129.  
  4130.  
  4131. global proc createRenderLayerOptions (string $parent) 
  4132. //
  4133. //  Procedure Name:
  4134. //      createRenderLayerOptions
  4135. //
  4136. //  Description:
  4137. //      Creates the UI in the "Render Layer/Pass Control" 
  4138. //        expand/collapse section.
  4139. //
  4140. {
  4141.     setUITemplate -pushTemplate attributeEditorTemplate;
  4142.  
  4143.     setParent $parent;
  4144.     string $cName;
  4145.  
  4146.     // Set up the spreadsheet filters
  4147.     updateRenderLayerFilters;
  4148.  
  4149.     // If the UI is created already then just update the attribute values.
  4150.     if (`columnLayout -exists rgRenderLayerLayout`) {
  4151.         updateRenderLayerOptions;
  4152.         return;
  4153.     }
  4154.  
  4155.     //columnLayout -adjustableColumn true rgRenderLayerLayout;
  4156.     columnLayout -adjustableColumn true rgRenderLayerLayout;
  4157.         checkBoxGrp -numberOfCheckBoxes 1
  4158.             -label1 "Enable Render Layers" 
  4159.             -cc "updateRenderLayerEnable"
  4160.             renderLayerEnable;
  4161.  
  4162.     
  4163.         checkBoxGrp -numberOfCheckBoxes 1
  4164.             -label1 "Enable Render Layer Passes" 
  4165.             -cc "updateRenderLayerPassEnable"
  4166.             renderLayerPassEnable;    
  4167.  
  4168.         checkBoxGrp -numberOfCheckBoxes 1
  4169.             -label1 "Enable Global Passes" 
  4170.             -cc "updateRenderGlobalPassEnable"
  4171.             renderGlobalPassEnable;    
  4172.  
  4173.         separator;
  4174.  
  4175.         checkBoxGrp -numberOfCheckBoxes 1
  4176.             -label1 "Output to Subdirectories" 
  4177.             //-cc "updateRenderLayerSubdirs"
  4178.             -cc "setAttr defaultRenderGlobals.renderLayerSubdirs #1"
  4179.             renderLayerSubdirs;
  4180.  
  4181.         //columnLayout bbby;
  4182.         //setParent ..;
  4183.         //button  -label "Save Composition File...";
  4184.  
  4185.         frameLayout
  4186.             -label "Render Layers"
  4187.             -labelVisible false
  4188.             -borderVisible false
  4189.             -collapsable false
  4190. //            -m false
  4191.             layerAttrLayout;
  4192.  
  4193.             columnLayout -adjustableColumn true layerLyt;
  4194.  
  4195.             separator;
  4196.  
  4197.              selectionConnection -wl -parent layerLyt aList;
  4198.             spreadSheetEditor 
  4199.                 -mainListConnection aList
  4200.                 -ko false
  4201.                 -ln true
  4202.                 -fal {"rndr"}
  4203.                 -filter renderLayerFilter
  4204.                 layerOutliner;
  4205.             setParent ..;
  4206.  
  4207.         setParent ..;
  4208.  
  4209.     setParent ..;
  4210.  
  4211.     setUITemplate -popTemplate;
  4212.  
  4213.     // Make sure the values are right
  4214.     updateRenderLayerOptions;
  4215. }
  4216.